Skip to content

Commit

Permalink
test(history): test initial navigation works with unicode
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Sep 4, 2018
1 parent c3b0a33 commit 67950d1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
5 changes: 4 additions & 1 deletion examples/basic/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Vue.use(VueRouter)
const Home = { template: '<div>home</div>' }
const Foo = { template: '<div>foo</div>' }
const Bar = { template: '<div>bar</div>' }
const Unicode = { template: '<div>unicode</div>' }

// 3. Create the router
const router = new VueRouter({
Expand All @@ -18,7 +19,8 @@ const router = new VueRouter({
routes: [
{ path: '/', component: Home },
{ path: '/foo', component: Foo },
{ path: '/bar', component: Bar }
{ path: '/bar', component: Bar },
{ path: '/é', component: Unicode }
]
})

Expand All @@ -37,6 +39,7 @@ new Vue({
<router-link tag="li" to="/bar" :event="['mousedown', 'touchstart']">
<a>/bar</a>
</router-link>
<li><router-link to="/é">/é</router-link></li>
</ul>
<router-view class="view"></router-view>
</div>
Expand Down
16 changes: 12 additions & 4 deletions test/e2e/specs/basic.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
module.exports = {
'basic': function (browser) {
basic: function (browser) {
browser
.url('http://localhost:8080/basic/')
.waitForElementVisible('#app', 1000)
.assert.count('li', 4)
.assert.count('li a', 4)
.assert.count('li', 5)
.assert.count('li a', 5)
// assert correct href with base
.assert.attributeContains('li:nth-child(1) a', 'href', '/basic/')
.assert.attributeContains('li:nth-child(2) a', 'href', '/basic/foo')
.assert.attributeContains('li:nth-child(3) a', 'href', '/basic/bar')
.assert.attributeContains('li:nth-child(4) a', 'href', '/basic/bar')
.assert.attributeContains('li:nth-child(5) a', 'href', '/basic/%C3%A9')
.assert.containsText('.view', 'home')

.click('li:nth-child(2) a')
Expand All @@ -28,10 +29,17 @@ module.exports = {
.assert.urlEquals('http://localhost:8080/basic/bar')
.assert.containsText('.view', 'bar')

// check initial visit
.click('li:nth-child(5) a')
.assert.urlEquals('http://localhost:8080/basic/%C3%A9')
.assert.containsText('.view', 'unicode')

// check initial visit
.url('http://localhost:8080/basic/foo')
.waitForElementVisible('#app', 1000)
.assert.containsText('.view', 'foo')
.url('http://localhost:8080/basic/%C3%A9')
.waitForElementVisible('#app', 1000)
.assert.containsText('.view', 'unicode')
.end()
}
}

0 comments on commit 67950d1

Please sign in to comment.