Commit b31416bc authored by Sindre Sorhus's avatar Sindre Sorhus

Merge pull request #859 from ColinEberhardt/routing-test

Added a test to verify that routing works with the back button
parents a82f3ee7 ba0bf8b1
...@@ -111,33 +111,57 @@ module.exports = [ ...@@ -111,33 +111,57 @@ module.exports = [
'TodoMVC - dijon, Editing, should cancel edits on escape', 'TodoMVC - dijon, Editing, should cancel edits on escape',
'TodoMVC - knockoutjs_require, Editing, should cancel edits on escape', 'TodoMVC - knockoutjs_require, Editing, should cancel edits on escape',
// all the following are covered by this issue:
// https://github.com/tastejs/todomvc/issues/856
'TodoMVC - knockoutjs, Routing, should respect the back button',
'TodoMVC - spine, Routing, should respect the back button',
'TodoMVC - componentjs, Routing, should respect the back button',
'TodoMVC - react, Routing, should respect the back button',
'TodoMVC - serenadejs, Routing, should respect the back button',
'TodoMVC - somajs, Routing, should respect the back button',
'TodoMVC - flight, Routing, should respect the back button',
'TodoMVC - lavaca_require, Routing, should respect the back button',
'TodoMVC - somajs_require, Routing, should respect the back button',
// all the following are covered by this issue: // all the following are covered by this issue:
// https://github.com/tastejs/todomvc/issues/790 // https://github.com/tastejs/todomvc/issues/790
// these implementations filter the view rather than the model when routing // these implementations filter the view rather than the model when routing
'TodoMVC - agilityjs, Routing, should allow me to display active items', 'TodoMVC - agilityjs, Routing, should allow me to display active items',
'TodoMVC - agilityjs, Routing, should allow me to display completed items', 'TodoMVC - agilityjs, Routing, should allow me to display completed items',
'TodoMVC - agilityjs, Routing, should respect the back button',
'TodoMVC - backbone, Routing, should allow me to display active items', 'TodoMVC - backbone, Routing, should allow me to display active items',
'TodoMVC - backbone, Routing, should allow me to display completed items', 'TodoMVC - backbone, Routing, should allow me to display completed items',
'TodoMVC - backbone, Routing, should respect the back button',
'TodoMVC - maria, Routing, should allow me to display active items', 'TodoMVC - maria, Routing, should allow me to display active items',
'TodoMVC - maria, Routing, should allow me to display completed items', 'TodoMVC - maria, Routing, should allow me to display completed items',
'TodoMVC - maria, Routing, should respect the back button',
'TodoMVC - dojo, Routing, should allow me to display active items', 'TodoMVC - dojo, Routing, should allow me to display active items',
'TodoMVC - dojo, Routing, should allow me to display completed items', 'TodoMVC - dojo, Routing, should allow me to display completed items',
'TodoMVC - dojo, Routing, should respect the back button',
'TodoMVC - atmajs, Routing, should allow me to display active items', 'TodoMVC - atmajs, Routing, should allow me to display active items',
'TodoMVC - atmajs, Routing, should allow me to display completed items', 'TodoMVC - atmajs, Routing, should allow me to display completed items',
'TodoMVC - atmajs, Routing, should respect the back button',
'TodoMVC - backbone_marionette, Routing, should allow me to display active items', 'TodoMVC - backbone_marionette, Routing, should allow me to display active items',
'TodoMVC - backbone_marionette, Routing, should allow me to display completed items', 'TodoMVC - backbone_marionette, Routing, should allow me to display completed items',
'TodoMVC - backbone_marionette, Routing, should respect the back button',
'TodoMVC - exoskeleton, Routing, should allow me to display active items', 'TodoMVC - exoskeleton, Routing, should allow me to display active items',
'TodoMVC - exoskeleton, Routing, should allow me to display completed items', 'TodoMVC - exoskeleton, Routing, should allow me to display completed items',
'TodoMVC - exoskeleton, Routing, should respect the back button',
'TodoMVC - thorax, Routing, should allow me to display active items', 'TodoMVC - thorax, Routing, should allow me to display active items',
'TodoMVC - thorax, Routing, should allow me to display completed items', 'TodoMVC - thorax, Routing, should allow me to display completed items',
'TodoMVC - thorax, Routing, should respect the back button',
'TodoMVC - thorax_lumbar, Routing, should allow me to display active items', 'TodoMVC - thorax_lumbar, Routing, should allow me to display active items',
'TodoMVC - thorax_lumbar, Routing, should allow me to display completed items', 'TodoMVC - thorax_lumbar, Routing, should allow me to display completed items',
'TodoMVC - thorax_lumbar, Routing, should respect the back button',
'TodoMVC - troopjs_require, Routing, should allow me to display active items', 'TodoMVC - troopjs_require, Routing, should allow me to display active items',
'TodoMVC - troopjs_require, Routing, should allow me to display completed items', 'TodoMVC - troopjs_require, Routing, should allow me to display completed items',
'TodoMVC - troopjs_require, Routing, should respect the back button',
'TodoMVC - backbone_require, Routing, should allow me to display active items', 'TodoMVC - backbone_require, Routing, should allow me to display active items',
'TodoMVC - backbone_require, Routing, should allow me to display completed items', 'TodoMVC - backbone_require, Routing, should allow me to display completed items',
'TodoMVC - backbone_require, Routing, should respect the back button',
'TodoMVC - ariatemplates, Routing, should allow me to display active items', 'TodoMVC - ariatemplates, Routing, should allow me to display active items',
'TodoMVC - ariatemplates, Routing, should allow me to display completed items', 'TodoMVC - ariatemplates, Routing, should allow me to display completed items',
'TodoMVC - ariatemplates, Routing, should respect the back button',
'TodoMVC - backbone_marionette_require, Routing, should allow me to display active items', 'TodoMVC - backbone_marionette_require, Routing, should allow me to display active items',
'TodoMVC - backbone_marionette_require, Routing, should allow me to display completed items', 'TodoMVC - backbone_marionette_require, Routing, should allow me to display completed items',
'TodoMVC - chaplin-brunch, Routing, should allow me to display active items', 'TodoMVC - chaplin-brunch, Routing, should allow me to display active items',
...@@ -159,26 +183,32 @@ module.exports = [ ...@@ -159,26 +183,32 @@ module.exports = [
'TodoMVC - extjs_deftjs, Routing, should allow me to display completed items', 'TodoMVC - extjs_deftjs, Routing, should allow me to display completed items',
'TodoMVC - extjs_deftjs, Routing, should allow me to display all items', 'TodoMVC - extjs_deftjs, Routing, should allow me to display all items',
'TodoMVC - extjs_deftjs, Routing, should highlight the currently applied filter', 'TodoMVC - extjs_deftjs, Routing, should highlight the currently applied filter',
'TodoMVC - extjs_deftjs, Routing, should respect the back button',
'TodoMVC - olives, Routing, should allow me to display active items', 'TodoMVC - olives, Routing, should allow me to display active items',
'TodoMVC - olives, Routing, should allow me to display completed items', 'TodoMVC - olives, Routing, should allow me to display completed items',
'TodoMVC - olives, Routing, should allow me to display all items', 'TodoMVC - olives, Routing, should allow me to display all items',
'TodoMVC - olives, Routing, should highlight the currently applied filter', 'TodoMVC - olives, Routing, should highlight the currently applied filter',
'TodoMVC - olives, Routing, should respect the back button',
'TodoMVC - dijon, Routing, should allow me to display active items', 'TodoMVC - dijon, Routing, should allow me to display active items',
'TodoMVC - dijon, Routing, should allow me to display completed items', 'TodoMVC - dijon, Routing, should allow me to display completed items',
'TodoMVC - dijon, Routing, should allow me to display all items', 'TodoMVC - dijon, Routing, should allow me to display all items',
'TodoMVC - dijon, Routing, should highlight the currently applied filter', 'TodoMVC - dijon, Routing, should highlight the currently applied filter',
'TodoMVC - dijon, Routing, should respect the back button',
'TodoMVC - duel, Routing, should allow me to display active items', 'TodoMVC - duel, Routing, should allow me to display active items',
'TodoMVC - duel, Routing, should allow me to display completed items', 'TodoMVC - duel, Routing, should allow me to display completed items',
'TodoMVC - duel, Routing, should allow me to display all items', 'TodoMVC - duel, Routing, should allow me to display all items',
'TodoMVC - duel, Routing, should highlight the currently applied filter', 'TodoMVC - duel, Routing, should highlight the currently applied filter',
'TodoMVC - duel, Routing, should respect the back button',
'TodoMVC - knockoutjs_require, Routing, should allow me to display active items', 'TodoMVC - knockoutjs_require, Routing, should allow me to display active items',
'TodoMVC - knockoutjs_require, Routing, should allow me to display completed items', 'TodoMVC - knockoutjs_require, Routing, should allow me to display completed items',
'TodoMVC - knockoutjs_require, Routing, should allow me to display all items', 'TodoMVC - knockoutjs_require, Routing, should allow me to display all items',
'TodoMVC - knockoutjs_require, Routing, should highlight the currently applied filter', 'TodoMVC - knockoutjs_require, Routing, should highlight the currently applied filter',
'TodoMVC - knockoutjs_require, Routing, should respect the back button',
'TodoMVC - angular-dart, Routing, should allow me to display active items', 'TodoMVC - angular-dart, Routing, should allow me to display active items',
'TodoMVC - angular-dart, Routing, should allow me to display completed items', 'TodoMVC - angular-dart, Routing, should allow me to display completed items',
'TodoMVC - angular-dart, Routing, should allow me to display all items', 'TodoMVC - angular-dart, Routing, should allow me to display all items',
'TodoMVC - angular-dart, Routing, should highlight the currently applied filter', 'TodoMVC - angular-dart, Routing, should highlight the currently applied filter',
'TodoMVC - angular-dart, Routing, should respect the back button',
'TodoMVC - typescript-backbone, Routing, should allow me to display active items', 'TodoMVC - typescript-backbone, Routing, should allow me to display active items',
'TodoMVC - typescript-backbone, Routing, should allow me to display completed items', 'TodoMVC - typescript-backbone, Routing, should allow me to display completed items',
'TodoMVC - typescript-backbone, Routing, should allow me to display all items', 'TodoMVC - typescript-backbone, Routing, should allow me to display all items',
...@@ -201,6 +231,7 @@ module.exports = [ ...@@ -201,6 +231,7 @@ module.exports = [
'TodoMVC - extjs, Routing, should allow me to display completed items', 'TodoMVC - extjs, Routing, should allow me to display completed items',
'TodoMVC - extjs, Routing, should allow me to display all items', 'TodoMVC - extjs, Routing, should allow me to display all items',
'TodoMVC - extjs, Routing, should highlight the currently applied filter', 'TodoMVC - extjs, Routing, should highlight the currently applied filter',
'TodoMVC - extjs, Routing, should respect the back button',
// stapes is completely broken! // stapes is completely broken!
// see: https://github.com/tastejs/todomvc/issues/808 // see: https://github.com/tastejs/todomvc/issues/808
...@@ -224,6 +255,7 @@ module.exports = [ ...@@ -224,6 +255,7 @@ module.exports = [
'TodoMVC - stapes, Routing, should allow me to display active items', 'TodoMVC - stapes, Routing, should allow me to display active items',
'TodoMVC - stapes, Routing, should allow me to display completed items', 'TodoMVC - stapes, Routing, should allow me to display completed items',
'TodoMVC - stapes, Routing, should allow me to display all items', 'TodoMVC - stapes, Routing, should allow me to display all items',
'TodoMVC - stapes, Routing, should respect the back button',
'TodoMVC - stapes_require, No Todos, should hide #main and #footer', 'TodoMVC - stapes_require, No Todos, should hide #main and #footer',
'TodoMVC - stapes_require, New Todo, should allow me to add todo items', 'TodoMVC - stapes_require, New Todo, should allow me to add todo items',
'TodoMVC - stapes_require, New Todo, should append new items to the bottom of the list', 'TodoMVC - stapes_require, New Todo, should append new items to the bottom of the list',
...@@ -247,6 +279,7 @@ module.exports = [ ...@@ -247,6 +279,7 @@ module.exports = [
'TodoMVC - stapes_require, Routing, should allow me to display active items', 'TodoMVC - stapes_require, Routing, should allow me to display active items',
'TodoMVC - stapes_require, Routing, should allow me to display completed items', 'TodoMVC - stapes_require, Routing, should allow me to display completed items',
'TodoMVC - stapes_require, Routing, should allow me to display all items', 'TodoMVC - stapes_require, Routing, should allow me to display all items',
'TodoMVC - stapes_require, Routing, should respect the back button',
// mozart is not on the public website // mozart is not on the public website
'TodoMVC - mozart, New Todo, should allow me to add todo items', 'TodoMVC - mozart, New Todo, should allow me to add todo items',
......
...@@ -23,6 +23,12 @@ module.exports = function Page(browser) { ...@@ -23,6 +23,12 @@ module.exports = function Page(browser) {
return this.getTodoListXpath() + '/li[' + (index + 1) + ']'; return this.getTodoListXpath() + '/li[' + (index + 1) + ']';
}; };
// ----------------- navigation methods
this.back = function() {
return browser.navigate().back();
}
// ----------------- try / get methods // ----------------- try / get methods
// unfortunately webdriver does not have a decent API for determining if an // unfortunately webdriver does not have a decent API for determining if an
......
...@@ -315,6 +315,25 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -315,6 +315,25 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
testOps.assertItems([TODO_ITEM_ONE, TODO_ITEM_THREE]); testOps.assertItems([TODO_ITEM_ONE, TODO_ITEM_THREE]);
}); });
test.it('should respect the back button', function () {
createStandardItems();
page.toggleItemAtIndex(1);
page.filterByActiveItems();
page.filterByCompletedItems();
// should show completed items
testOps.assertItems([TODO_ITEM_TWO]);
// then active items
page.back();
testOps.assertItems([TODO_ITEM_ONE, TODO_ITEM_THREE]);
// then all items
page.back();
testOps.assertItems([TODO_ITEM_ONE, TODO_ITEM_TWO, TODO_ITEM_THREE]);
});
test.it('should allow me to display completed items', function () { test.it('should allow me to display completed items', function () {
createStandardItems(); createStandardItems();
page.toggleItemAtIndex(1); page.toggleItemAtIndex(1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment