Skip to content

Commit

Permalink
test: fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Diaz committed Jul 21, 2019
1 parent a1cdff2 commit 181b04b
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions tests/unit/StatusIndicator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ const createComponent = propsData => shallowMount(StatusIndicator, { propsData }

describe('VueStatusIndicator.vue', () => {
let cmp;
it('has a mounted hook', () => {
expect(typeof StatusIndicator.mounted).toBe('function');
});

it('should match the snapshot', () => {
expect(vm.$el).toMatchSnapshot();
});
Expand All @@ -20,43 +16,55 @@ describe('VueStatusIndicator.vue', () => {
it('should be showed with the default color if the status prop not set', () => {
cmp = createComponent();
expect(cmp.vm.status).toBe('');
expect(cmp.vm.$el.active).toBe(undefined);
expect(cmp.vm.pulse).toBeFalsy();
expect(cmp.vm.$el.hasAttribute('status')).toBeFalsy();
expect(cmp.vm.$el.hasAttribute('pulse')).toBeFalsy();
});

it('should be showed with the active color if the status prop is set', () => {
it('should be showed with the positive color if the status prop is set', () => {
cmp = createComponent({ status: 'active' });
expect(cmp.vm.status).toBe('active');
expect(cmp.vm.$el.active).toBe('');
expect(cmp.vm.pulse).toBeFalsy();
expect(cmp.vm.$el.hasAttribute('active')).toBeTruthy();
expect(cmp.vm.$el.hasAttribute('pulse')).toBeFalsy();
});

it('should be showed with the positive color if the status prop is set', () => {
cmp = createComponent({ status: 'positive' });
expect(cmp.vm.status).toBe('positive');
expect(cmp.vm.$el.positive).toBe('');
expect(cmp.vm.pulse).toBeFalsy();
expect(cmp.vm.$el.hasAttribute('positive')).toBeTruthy();
expect(cmp.vm.$el.hasAttribute('pulse')).toBeFalsy();
});

it('should be showed with the intermediary color if the status prop is set', () => {
cmp = createComponent({ status: 'intermediary' });
expect(cmp.vm.status).toBe('intermediary');
expect(cmp.vm.$el.intermediary).toBe('');
expect(cmp.vm.pulse).toBeFalsy();
expect(cmp.vm.$el.hasAttribute('intermediary')).toBeTruthy();
expect(cmp.vm.$el.hasAttribute('pulse')).toBeFalsy();
});

it('should be showed with the negative color if the status prop is set', () => {
cmp = createComponent({ status: 'negative' });
expect(cmp.vm.status).toBe('negative');
expect(cmp.vm.$el.negative).toBe('');
expect(cmp.vm.pulse).toBeFalsy();
expect(cmp.vm.$el.hasAttribute('negative')).toBeTruthy();
expect(cmp.vm.$el.hasAttribute('pulse')).toBeFalsy();
});

it('should be showed without pulse effect when the pulse prop is false by default', () => {
cmp = createComponent();
expect(cmp.vm.status).toBeFalsy();
expect(cmp.vm.$el.pulse).toBe(undefined);
expect(cmp.vm.status).toBe('');
expect(cmp.vm.pulse).toBeFalsy();
expect(cmp.vm.$el.hasAttribute('pulse')).toBeFalsy();
});

it('should be showed with pulse effect when the pulse prop is false by default', () => {
cmp = createComponent({ pulse: true });
expect(cmp.vm.status).toBe('');
expect(cmp.vm.pulse).toBeTruthy();
expect(cmp.vm.$el.pulse).toBe('');
expect(cmp.vm.$el.hasAttribute('pulse')).toBeTruthy();
});
});
});

0 comments on commit 181b04b

Please sign in to comment.