diff --git a/examples/basic/app.js b/examples/basic/app.js index 1744a41cc..1242bf98b 100644 --- a/examples/basic/app.js +++ b/examples/basic/app.js @@ -34,6 +34,7 @@ new Vue({
  • /
  • /foo
  • /bar
  • + /bar diff --git a/src/components/link.js b/src/components/link.js index 0fdfd8e4e..1b312f17c 100644 --- a/src/components/link.js +++ b/src/components/link.js @@ -64,6 +64,9 @@ export default { aData.on = on const aAttrs = aData.attrs || (aData.attrs = {}) aAttrs.href = href + } else { + // doesn't have child, apply listener to self + data.on = on } } diff --git a/test/e2e/specs/basic.js b/test/e2e/specs/basic.js index 6dfcf5372..bfe53d538 100644 --- a/test/e2e/specs/basic.js +++ b/test/e2e/specs/basic.js @@ -3,6 +3,7 @@ module.exports = { browser .url('http://localhost:8080/basic/') .waitForElementVisible('#app', 1000) + .assert.count('li', 4) .assert.count('li a', 3) // assert correct href with base .assert.attributeContains('li:nth-child(1) a', 'href', '/basic/') @@ -22,6 +23,10 @@ module.exports = { .assert.urlEquals('http://localhost:8080/basic/') .assert.containsText('.view', 'home') + .click('li:nth-child(4)') + .assert.urlEquals('http://localhost:8080/basic/bar') + .assert.containsText('.view', 'bar') + // check initial visit .url('http://localhost:8080/basic/foo') .waitForElementVisible('#app', 1000)