1
1
import { test } from 'qunit' ;
2
2
import moduleForAcceptance from 'cargo/tests/helpers/module-for-acceptance' ;
3
- import matchesText from 'cargo/tests/helpers/matches-text' ;
4
- import hasText from 'cargo/tests/helpers/has-text' ;
5
3
6
4
moduleForAcceptance ( 'Acceptance | crate page' ) ;
7
5
@@ -26,8 +24,8 @@ test('visiting /crates/nanomsg', async function(assert) {
26
24
assert . equal ( currentRouteName ( ) , 'crate.index' ) ;
27
25
assert . equal ( document . title , 'nanomsg - Cargo: packages for Rust' ) ;
28
26
29
- assert . equal ( find ( '#crates-heading .info h1' ) . text ( ) , 'nanomsg' ) ;
30
- assert . equal ( find ( '#crates-heading .info h2' ) . text ( ) , '0.6.1' ) ;
27
+ assert . dom ( '#crates-heading .info h1' ) . hasText ( 'nanomsg' ) ;
28
+ assert . dom ( '#crates-heading .info h2' ) . hasText ( '0.6.1' ) ;
31
29
} ) ;
32
30
33
31
test ( 'visiting /crates/nanomsg/' , async function ( assert ) {
@@ -41,8 +39,8 @@ test('visiting /crates/nanomsg/', async function(assert) {
41
39
assert . equal ( currentRouteName ( ) , 'crate.index' ) ;
42
40
assert . equal ( document . title , 'nanomsg - Cargo: packages for Rust' ) ;
43
41
44
- assert . equal ( find ( '#crates-heading .info h1' ) . text ( ) , 'nanomsg' ) ;
45
- assert . equal ( find ( '#crates-heading .info h2' ) . text ( ) , '0.6.1' ) ;
42
+ assert . dom ( '#crates-heading .info h1' ) . hasText ( 'nanomsg' ) ;
43
+ assert . dom ( '#crates-heading .info h2' ) . hasText ( '0.6.1' ) ;
46
44
} ) ;
47
45
48
46
test ( 'visiting /crates/nanomsg/0.6.0' , async function ( assert ) {
@@ -56,8 +54,8 @@ test('visiting /crates/nanomsg/0.6.0', async function(assert) {
56
54
assert . equal ( currentRouteName ( ) , 'crate.version' ) ;
57
55
assert . equal ( document . title , 'nanomsg - Cargo: packages for Rust' ) ;
58
56
59
- assert . equal ( find ( '#crates-heading .info h1' ) . text ( ) , 'nanomsg' ) ;
60
- assert . equal ( find ( '#crates-heading .info h2' ) . text ( ) , '0.6.0' ) ;
57
+ assert . dom ( '#crates-heading .info h1' ) . hasText ( 'nanomsg' ) ;
58
+ assert . dom ( '#crates-heading .info h2' ) . hasText ( '0.6.0' ) ;
61
59
} ) ;
62
60
63
61
test ( 'navigating to the all versions page' , async function ( assert ) {
@@ -66,7 +64,7 @@ test('navigating to the all versions page', async function(assert) {
66
64
await visit ( '/crates/nanomsg' ) ;
67
65
await click ( '#crate-versions span.small a' ) ;
68
66
69
- matchesText ( assert , '.info' , / A l l 1 3 v e r s i o n s o f n a n o m s g s i n c e D e c e m b e r \d + , 2 0 1 4 / ) ;
67
+ assert . dom ( '.info' ) . hasText ( / A l l 1 3 \s + v e r s i o n s o f n a n o m s g s i n c e \s + D e c e m b e r \d + , 2 0 1 4 / ) ;
70
68
} ) ;
71
69
72
70
test ( 'navigating to the reverse dependencies page' , async function ( assert ) {
@@ -76,10 +74,7 @@ test('navigating to the reverse dependencies page', async function(assert) {
76
74
await click ( 'a:contains("Dependent crates")' ) ;
77
75
78
76
assert . equal ( currentURL ( ) , '/crates/nanomsg/reverse_dependencies' ) ;
79
-
80
- const $revDep = findWithAssert ( 'a[href="/crates/unicorn-rpc"]:first' ) ;
81
-
82
- hasText ( assert , $revDep , 'unicorn-rpc' ) ;
77
+ assert . dom ( 'a[href="/crates/unicorn-rpc"]' ) . hasText ( 'unicorn-rpc' ) ;
83
78
} ) ;
84
79
85
80
test ( 'navigating to a user page' , async function ( assert ) {
@@ -89,7 +84,7 @@ test('navigating to a user page', async function(assert) {
89
84
await click ( '.owners li:last a' ) ;
90
85
91
86
assert . equal ( currentURL ( ) , '/users/blabaere' ) ;
92
- hasText ( assert , '#crates-heading h1' , 'blabaere' ) ;
87
+ assert . dom ( '#crates-heading h1' ) . hasText ( 'blabaere' ) ;
93
88
} ) ;
94
89
95
90
test ( 'navigating to a team page' , async function ( assert ) {
@@ -99,32 +94,33 @@ test('navigating to a team page', async function(assert) {
99
94
await click ( '.owners li:first a ' ) ;
100
95
101
96
assert . equal ( currentURL ( ) , '/teams/github:org:thehydroimpulse' ) ;
102
- hasText ( assert , '.team-info h2' , 'thehydroimpulseteam' ) ;
97
+ assert . dom ( '.team-info h2' ) . hasText ( 'thehydroimpulseteam' ) ;
103
98
} ) ;
104
99
105
100
test ( 'crates having user-owners' , async function ( assert ) {
106
101
server . loadFixtures ( ) ;
107
102
108
103
await visit ( '/crates/nanomsg' ) ;
109
104
110
- findWithAssert ( 'ul.owners li:first a[href="/teams/github:org:thehydroimpulse"] img[src="https://avatars.githubusercontent.com/u/565790?v=3&s=64"]' ) ;
111
- assert . equal ( find ( 'ul.owners li' ) . length , 4 ) ;
105
+ assert . dom ( 'ul.owners li a[href="/teams/github:org:thehydroimpulse"] img[src="https://avatars.githubusercontent.com/u/565790?v=3&s=64"]' ) . exists ( ) ;
106
+ assert . dom ( 'ul.owners li' ) . exists ( { count : 4 } ) ;
112
107
} ) ;
113
108
114
109
test ( 'crates having team-owners' , async function ( assert ) {
115
110
server . loadFixtures ( ) ;
116
111
117
112
await visit ( '/crates/nanomsg' ) ;
118
113
119
- findWithAssert ( 'ul.owners li:first a[href="/teams/github:org:thehydroimpulse"]' ) ;
120
- assert . equal ( find ( 'ul.owners li' ) . length , 4 ) ;
114
+ assert . dom ( 'ul.owners li a[href="/teams/github:org:thehydroimpulse"]' ) . exists ( ) ;
115
+ assert . dom ( 'ul.owners li' ) . exists ( { count : 4 } ) ;
121
116
} ) ;
122
117
123
118
test ( 'crates license is supplied by version' , async function ( assert ) {
124
119
server . loadFixtures ( ) ;
125
120
126
121
await visit ( '/crates/nanomsg' ) ;
127
- hasText ( assert , '.license' , 'Apache-2.0' ) ;
122
+ assert . dom ( '.license' ) . hasText ( 'Apache-2.0' ) ;
123
+
128
124
await click ( '#crate-versions a:contains("0.5.0")' ) ;
129
- hasText ( assert , '.license' , 'MIT/Apache-2.0' ) ;
125
+ assert . dom ( '.license' ) . hasText ( 'MIT/Apache-2.0' ) ;
130
126
} ) ;
0 commit comments