1
1
import { Selector } from 'testcafe' ;
2
2
import { TreeDriver } from './helpers/tree.driver' ;
3
3
4
- fixture . skip `Basic`
4
+ fixture `Basic`
5
5
. page `http://localhost:4200/#/basic`
6
6
. beforeEach ( async t => {
7
7
t . ctx . tree = new TreeDriver ( 'tree-root' ) ;
@@ -13,121 +13,121 @@ fixture.skip `Basic`
13
13
} ) ;
14
14
15
15
test ( 'should show the tree' , async t => {
16
- await t . expect ( t . ctx . tree . isPresent ( ) ) . toBe ( true ) ;
16
+ await t . expect ( t . ctx . tree . isPresent ( ) ) . eql ( true ) ;
17
17
} ) ;
18
18
19
19
test ( 'should have 5 nodes' , async t => {
20
- await t . expect ( t . ctx . tree . getNodes ( ) . count ) . toEqual ( 5 ) ;
20
+ await t . expect ( t . ctx . tree . getNodes ( ) . count ) . eql ( 5 ) ;
21
21
} ) ;
22
22
23
23
test ( 'should have a node named root1' , async t => {
24
- await t . expect ( t . ctx . root1 . isPresent ( ) ) . toBe ( true ) ;
24
+ await t . expect ( t . ctx . root1 . isPresent ( ) ) . eql ( true ) ;
25
25
} ) ;
26
26
27
27
test ( 'roots with children should have an expander icon' , async t => {
28
- await t . expect ( t . ctx . root1 . getExpander ( ) . isPresent ( ) ) . toBe ( true )
29
- . expect ( t . ctx . root2 . getExpander ( ) . isPresent ( ) ) . toBe ( true ) ;
28
+ await t . expect ( t . ctx . root1 . getExpander ( ) . exists ) . eql ( true )
29
+ . expect ( t . ctx . root2 . getExpander ( ) . exists ) . eql ( true ) ;
30
30
} ) ;
31
31
32
32
test ( 'roots with children should not have an expander icon' , async t => {
33
- await t . expect ( t . ctx . root3 . getExpander ( ) . isPresent ( ) ) . toBe ( false )
34
- . expect ( t . ctx . root4 . getExpander ( ) . isPresent ( ) ) . toBe ( false )
35
- . expect ( t . ctx . root5 . getExpander ( ) . isPresent ( ) ) . toBe ( false ) ;
33
+ await t . expect ( t . ctx . root3 . getExpander ( ) . exists ) . eql ( false )
34
+ . expect ( t . ctx . root4 . getExpander ( ) . exists ) . eql ( false )
35
+ . expect ( t . ctx . root5 . getExpander ( ) . exists ) . eql ( false ) ;
36
36
} ) ;
37
37
38
38
test ( 'roots with children should start collapsed' , async t => {
39
- await t . expect ( t . ctx . root1 . getChildren ( ) . isPresent ( ) ) . toBe ( false )
40
- . expect ( t . ctx . root1 . isExpanded ( ) ) . toBe ( false ) ;
39
+ await t . expect ( t . ctx . root1 . getChildren ( ) . exists ) . eql ( false )
40
+ . expect ( t . ctx . root1 . isExpanded ( ) ) . eql ( false ) ;
41
41
} ) ;
42
42
43
43
test ( 'should expand & collapse children on click expander' , async t => {
44
44
await t . ctx . root1 . clickExpander ( t ) ;
45
- await t . expect ( t . ctx . root1 . getChildren ( ) . isPresent ( ) ) . toBe ( true )
46
- . expect ( t . ctx . root1 . isExpanded ( ) ) . toBe ( true ) ;
45
+ await t . expect ( t . ctx . root1 . getChildren ( ) . exists ) . eql ( true )
46
+ . expect ( t . ctx . root1 . isExpanded ( ) ) . eql ( true ) ;
47
47
await t . ctx . root1 . clickExpander ( t ) ;
48
- await t . expect ( t . ctx . root1 . getChildren ( ) . isPresent ( ) ) . toBe ( false )
49
- . expect ( t . ctx . root1 . isExpanded ( ) ) . toBe ( false ) ;
48
+ await t . expect ( t . ctx . root1 . getChildren ( ) . exists ) . eql ( false )
49
+ . expect ( t . ctx . root1 . isExpanded ( ) ) . eql ( false ) ;
50
50
} ) ;
51
51
52
52
test ( 'should start inactive' , async t => {
53
- await t . expect ( t . ctx . root1 . isActive ( ) ) . toBe ( false ) ;
53
+ await t . expect ( t . ctx . root1 . isActive ( ) ) . eql ( false ) ;
54
54
} ) ;
55
55
56
56
test ( 'should activate & deactivate nodes on click' , async t => {
57
57
await t . ctx . root1 . click ( t ) ;
58
- await t . expect ( t . ctx . root1 . isActive ( ) ) . toBe ( true )
59
- . expect ( t . ctx . root2 . isActive ( ) ) . toBe ( false ) ;
58
+ await t . expect ( t . ctx . root1 . isActive ( ) ) . eql ( true )
59
+ . expect ( t . ctx . root2 . isActive ( ) ) . eql ( false ) ;
60
60
await t . ctx . root2 . click ( t ) ;
61
- await t . expect ( t . ctx . root1 . isActive ( ) ) . toBe ( false )
62
- . expect ( t . ctx . root2 . isActive ( ) ) . toBe ( true ) ;
61
+ await t . expect ( t . ctx . root1 . isActive ( ) ) . eql ( false )
62
+ . expect ( t . ctx . root2 . isActive ( ) ) . eql ( true ) ;
63
63
} ) ;
64
64
65
65
test ( 'should start without focus' , async t => {
66
- await t . expect ( t . ctx . root1 . isFocused ( ) ) . toBe ( false ) ;
66
+ await t . expect ( t . ctx . root1 . isFocused ( ) ) . eql ( false ) ;
67
67
} ) ;
68
68
69
69
test ( 'should focus on a node on click' , async t => {
70
70
await t . ctx . root1 . click ( t ) ;
71
- await t . expect ( t . ctx . root1 . isFocused ( ) ) . toBe ( true )
72
- . expect ( t . ctx . root2 . isFocused ( ) ) . toBe ( false ) ;
71
+ await t . expect ( t . ctx . root1 . isFocused ( ) ) . eql ( true )
72
+ . expect ( t . ctx . root2 . isFocused ( ) ) . eql ( false ) ;
73
73
await t . ctx . root2 . click ( t ) ;
74
- await t . expect ( t . ctx . root1 . isFocused ( ) ) . toBe ( false )
75
- expect ( t . ctx . root2 . isFocused ( ) ) . toBe ( true ) ;
74
+ await t . expect ( t . ctx . root1 . isFocused ( ) ) . eql ( false )
75
+ . expect ( t . ctx . root2 . isFocused ( ) ) . eql ( true ) ;
76
76
} ) ;
77
77
78
78
test ( 'should navigate with keys' , async t => {
79
79
await t . ctx . tree . keyDown ( t ) ;
80
- await t . expect ( t . ctx . root1 . isFocused ( ) ) . toBe ( true ) ;
80
+ await t . expect ( t . ctx . root1 . isFocused ( ) ) . eql ( true ) ;
81
81
await t . ctx . tree . keyRight ( t ) ;
82
- await t . expect ( t . ctx . root1 . isExpanded ( ) ) . toBe ( true ) ;
82
+ await t . expect ( t . ctx . root1 . isExpanded ( ) ) . eql ( true ) ;
83
83
await t . ctx . tree . keyRight ( t ) ;
84
84
85
85
const child1 = t . ctx . tree . getNode ( 'child1' ) ;
86
86
const child2 = t . ctx . tree . getNode ( 'child2' ) ;
87
87
88
- await t . expect ( child1 . isFocused ( ) ) . toBe ( true ) ;
88
+ await t . expect ( child1 . isFocused ( ) ) . eql ( true ) ;
89
89
await t . ctx . tree . keyRight ( t ) ;
90
- await t . expect ( child1 . isFocused ( ) ) . toBe ( true ) ;
90
+ await t . expect ( child1 . isFocused ( ) ) . eql ( true ) ;
91
91
await t . ctx . tree . keyDown ( t ) ;
92
92
await t . ctx . tree . keyDown ( t ) ;
93
- await t . expect ( t . ctx . root2 . isFocused ( ) ) . toBe ( true ) ;
93
+ await t . expect ( t . ctx . root2 . isFocused ( ) ) . eql ( true ) ;
94
94
await t . ctx . tree . keyUp ( t ) ;
95
- await t . expect ( child2 . isFocused ( ) ) . toBe ( true ) ;
95
+ await t . expect ( child2 . isFocused ( ) ) . eql ( true ) ;
96
96
await t . ctx . tree . keyLeft ( t ) ;
97
- await t . expect ( t . ctx . root1 . isFocused ( ) ) . toBe ( true ) ;
97
+ await t . expect ( t . ctx . root1 . isFocused ( ) ) . eql ( true ) ;
98
98
await t . ctx . tree . keyLeft ( t ) ;
99
- await t . expect ( t . ctx . root1 . isExpanded ( ) ) . toBe ( false ) ;
99
+ await t . expect ( t . ctx . root1 . isExpanded ( ) ) . eql ( false ) ;
100
100
await t . ctx . tree . keyDown ( t ) ;
101
- await t . expect ( t . ctx . root2 . isFocused ( ) ) . toBe ( true ) ;
101
+ await t . expect ( t . ctx . root2 . isFocused ( ) ) . eql ( true ) ;
102
102
await t . ctx . tree . keyUp ( t ) ;
103
- await t . expect ( t . ctx . root1 . isFocused ( ) ) . toBe ( true ) ;
103
+ await t . expect ( t . ctx . root1 . isFocused ( ) ) . eql ( true ) ;
104
104
} ) ;
105
105
106
106
test ( 'should toggle active on space' , async t => {
107
- await t . expect ( t . ctx . root1 . isActive ( ) ) . toBe ( false ) ;
107
+ await t . expect ( t . ctx . root1 . isActive ( ) ) . eql ( false ) ;
108
108
await t . ctx . tree . keyDown ( t ) ;
109
109
await t . ctx . tree . keySpace ( t ) ;
110
- await t . expect ( t . ctx . root1 . isActive ( ) ) . toBe ( true ) ;
110
+ await t . expect ( t . ctx . root1 . isActive ( ) ) . eql ( true ) ;
111
111
await t . ctx . tree . keyDown ( t ) ;
112
112
await t . ctx . tree . keySpace ( t ) ;
113
- await t . expect ( t . ctx . root2 . isActive ( ) ) . toBe ( true ) ;
113
+ await t . expect ( t . ctx . root2 . isActive ( ) ) . eql ( true ) ;
114
114
await t . ctx . tree . keySpace ( t ) ;
115
- await t . expect ( t . ctx . root2 . isActive ( ) ) . toBe ( false ) ;
115
+ await t . expect ( t . ctx . root2 . isActive ( ) ) . eql ( false ) ;
116
116
} ) ;
117
117
118
118
test ( 'should toggle active on enter' , async t => {
119
- await t . expect ( t . ctx . root1 . isActive ( ) ) . toBe ( false ) ;
119
+ await t . expect ( t . ctx . root1 . isActive ( ) ) . eql ( false ) ;
120
120
await t . ctx . tree . keyDown ( t ) ;
121
121
await t . ctx . tree . keyEnter ( t ) ;
122
- await t . expect ( t . ctx . root1 . isActive ( ) ) . toBe ( true ) ;
122
+ await t . expect ( t . ctx . root1 . isActive ( ) ) . eql ( true ) ;
123
123
await t . ctx . tree . keyDown ( t ) ;
124
124
await t . ctx . tree . keyEnter ( t ) ;
125
- await t . expect ( t . ctx . root2 . isActive ( ) ) . toBe ( true ) ;
125
+ await t . expect ( t . ctx . root2 . isActive ( ) ) . eql ( true ) ;
126
126
await t . ctx . tree . keyEnter ( t ) ;
127
- await t . expect ( t . ctx . root2 . isActive ( ) ) . toBe ( false ) ;
127
+ await t . expect ( t . ctx . root2 . isActive ( ) ) . eql ( false ) ;
128
128
} ) ;
129
129
130
130
test ( 'should not show checkboxes' , async t => {
131
- expect ( t . ctx . root1 . getCheckbox ( ) . isPresent ( ) ) . toBe ( false ) ;
131
+ await t . expect ( t . ctx . root1 . getCheckbox ( ) . exists ) . eql ( false ) ;
132
132
} ) ;
133
133
0 commit comments