Skip to content

Commit 181b04b

Browse files
author
Javier Diaz
committed
test: fixed tests
1 parent a1cdff2 commit 181b04b

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

tests/unit/StatusIndicator.spec.js

+21-13
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ const createComponent = propsData => shallowMount(StatusIndicator, { propsData }
88

99
describe('VueStatusIndicator.vue', () => {
1010
let cmp;
11-
it('has a mounted hook', () => {
12-
expect(typeof StatusIndicator.mounted).toBe('function');
13-
});
14-
1511
it('should match the snapshot', () => {
1612
expect(vm.$el).toMatchSnapshot();
1713
});
@@ -20,43 +16,55 @@ describe('VueStatusIndicator.vue', () => {
2016
it('should be showed with the default color if the status prop not set', () => {
2117
cmp = createComponent();
2218
expect(cmp.vm.status).toBe('');
23-
expect(cmp.vm.$el.active).toBe(undefined);
19+
expect(cmp.vm.pulse).toBeFalsy();
20+
expect(cmp.vm.$el.hasAttribute('status')).toBeFalsy();
21+
expect(cmp.vm.$el.hasAttribute('pulse')).toBeFalsy();
2422
});
2523

26-
it('should be showed with the active color if the status prop is set', () => {
24+
it('should be showed with the positive color if the status prop is set', () => {
2725
cmp = createComponent({ status: 'active' });
2826
expect(cmp.vm.status).toBe('active');
29-
expect(cmp.vm.$el.active).toBe('');
27+
expect(cmp.vm.pulse).toBeFalsy();
28+
expect(cmp.vm.$el.hasAttribute('active')).toBeTruthy();
29+
expect(cmp.vm.$el.hasAttribute('pulse')).toBeFalsy();
3030
});
3131

3232
it('should be showed with the positive color if the status prop is set', () => {
3333
cmp = createComponent({ status: 'positive' });
3434
expect(cmp.vm.status).toBe('positive');
35-
expect(cmp.vm.$el.positive).toBe('');
35+
expect(cmp.vm.pulse).toBeFalsy();
36+
expect(cmp.vm.$el.hasAttribute('positive')).toBeTruthy();
37+
expect(cmp.vm.$el.hasAttribute('pulse')).toBeFalsy();
3638
});
3739

3840
it('should be showed with the intermediary color if the status prop is set', () => {
3941
cmp = createComponent({ status: 'intermediary' });
4042
expect(cmp.vm.status).toBe('intermediary');
41-
expect(cmp.vm.$el.intermediary).toBe('');
43+
expect(cmp.vm.pulse).toBeFalsy();
44+
expect(cmp.vm.$el.hasAttribute('intermediary')).toBeTruthy();
45+
expect(cmp.vm.$el.hasAttribute('pulse')).toBeFalsy();
4246
});
4347

4448
it('should be showed with the negative color if the status prop is set', () => {
4549
cmp = createComponent({ status: 'negative' });
4650
expect(cmp.vm.status).toBe('negative');
47-
expect(cmp.vm.$el.negative).toBe('');
51+
expect(cmp.vm.pulse).toBeFalsy();
52+
expect(cmp.vm.$el.hasAttribute('negative')).toBeTruthy();
53+
expect(cmp.vm.$el.hasAttribute('pulse')).toBeFalsy();
4854
});
4955

5056
it('should be showed without pulse effect when the pulse prop is false by default', () => {
5157
cmp = createComponent();
52-
expect(cmp.vm.status).toBeFalsy();
53-
expect(cmp.vm.$el.pulse).toBe(undefined);
58+
expect(cmp.vm.status).toBe('');
59+
expect(cmp.vm.pulse).toBeFalsy();
60+
expect(cmp.vm.$el.hasAttribute('pulse')).toBeFalsy();
5461
});
5562

5663
it('should be showed with pulse effect when the pulse prop is false by default', () => {
5764
cmp = createComponent({ pulse: true });
65+
expect(cmp.vm.status).toBe('');
5866
expect(cmp.vm.pulse).toBeTruthy();
59-
expect(cmp.vm.$el.pulse).toBe('');
67+
expect(cmp.vm.$el.hasAttribute('pulse')).toBeTruthy();
6068
});
6169
});
6270
});

0 commit comments

Comments
 (0)