forked from vuejs/vue-router
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhash-mode.js
45 lines (39 loc) · 1.7 KB
/
hash-mode.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
module.exports = {
'Hash mode': function (browser) {
browser
.url('http://localhost:8080/hash-mode/')
.waitForElementVisible('#app', 1000)
.assert.count('li', 5)
.assert.count('li a', 4)
.assert.attributeContains('li:nth-child(1) a', 'href', '/hash-mode/#/')
.assert.attributeContains('li:nth-child(2) a', 'href', '/hash-mode/#/foo')
.assert.attributeContains('li:nth-child(3) a', 'href', '/hash-mode/#/bar')
.assert.attributeContains('li:nth-child(5) a', 'href', '/hash-mode/#/%C3%A9')
.assert.containsText('.view', 'home')
.click('li:nth-child(2) a')
.assert.urlEquals('http://localhost:8080/hash-mode/#/foo')
.assert.containsText('.view', 'foo')
.click('li:nth-child(3) a')
.assert.urlEquals('http://localhost:8080/hash-mode/#/bar')
.assert.containsText('.view', 'bar')
.click('li:nth-child(1) a')
.assert.urlEquals('http://localhost:8080/hash-mode/#/')
.assert.containsText('.view', 'home')
.click('li:nth-child(4)')
.assert.urlEquals('http://localhost:8080/hash-mode/#/bar')
.assert.containsText('.view', 'bar')
// check initial visit
.url('http://localhost:8080/hash-mode/#/foo')
.waitForElementVisible('#app', 1000)
.assert.containsText('.view', 'foo')
.url('http://localhost:8080/hash-mode/#/%C3%A9')
.waitForElementVisible('#app', 1000)
.assert.containsText('.view', 'unicode')
// check hash placed correctly
.url('http://localhost:8080/hash-mode/foo?page=123')
.waitForElementVisible('#app', 1000)
.assert.urlEquals('http://localhost:8080/hash-mode/#/foo?page=123')
.assert.containsText('.view', 'foo')
.end()
}
}