@@ -8,10 +8,6 @@ const createComponent = propsData => shallowMount(StatusIndicator, { propsData }
8
8
9
9
describe ( 'VueStatusIndicator.vue' , ( ) => {
10
10
let cmp ;
11
- it ( 'has a mounted hook' , ( ) => {
12
- expect ( typeof StatusIndicator . mounted ) . toBe ( 'function' ) ;
13
- } ) ;
14
-
15
11
it ( 'should match the snapshot' , ( ) => {
16
12
expect ( vm . $el ) . toMatchSnapshot ( ) ;
17
13
} ) ;
@@ -20,43 +16,55 @@ describe('VueStatusIndicator.vue', () => {
20
16
it ( 'should be showed with the default color if the status prop not set' , ( ) => {
21
17
cmp = createComponent ( ) ;
22
18
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 ( ) ;
24
22
} ) ;
25
23
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' , ( ) => {
27
25
cmp = createComponent ( { status : 'active' } ) ;
28
26
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 ( ) ;
30
30
} ) ;
31
31
32
32
it ( 'should be showed with the positive color if the status prop is set' , ( ) => {
33
33
cmp = createComponent ( { status : 'positive' } ) ;
34
34
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 ( ) ;
36
38
} ) ;
37
39
38
40
it ( 'should be showed with the intermediary color if the status prop is set' , ( ) => {
39
41
cmp = createComponent ( { status : 'intermediary' } ) ;
40
42
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 ( ) ;
42
46
} ) ;
43
47
44
48
it ( 'should be showed with the negative color if the status prop is set' , ( ) => {
45
49
cmp = createComponent ( { status : 'negative' } ) ;
46
50
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 ( ) ;
48
54
} ) ;
49
55
50
56
it ( 'should be showed without pulse effect when the pulse prop is false by default' , ( ) => {
51
57
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 ( ) ;
54
61
} ) ;
55
62
56
63
it ( 'should be showed with pulse effect when the pulse prop is false by default' , ( ) => {
57
64
cmp = createComponent ( { pulse : true } ) ;
65
+ expect ( cmp . vm . status ) . toBe ( '' ) ;
58
66
expect ( cmp . vm . pulse ) . toBeTruthy ( ) ;
59
- expect ( cmp . vm . $el . pulse ) . toBe ( '' ) ;
67
+ expect ( cmp . vm . $el . hasAttribute ( ' pulse' ) ) . toBeTruthy ( ) ;
60
68
} ) ;
61
69
} ) ;
62
70
} ) ;
0 commit comments