Commit 8c1fca7b authored by Arthur Verschaeve's avatar Arthur Verschaeve

Move repeating piece the code to a `beforeEach` hook

Fix #1410
parent a64ef10c
...@@ -203,27 +203,23 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -203,27 +203,23 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
}); });
test.describe('Editing', function () { test.describe('Editing', function () {
test.it('should hide other controls when editing', function () { test.beforeEach(function () {
createStandardItems(); createStandardItems();
page.doubleClickItemAtIndex(1); page.doubleClickItemAtIndex(1);
});
test.it('should hide other controls when editing', function () {
testOps.assertItemToggleIsHidden(1); testOps.assertItemToggleIsHidden(1);
testOps.assertItemLabelIsHidden(1); testOps.assertItemLabelIsHidden(1);
}); });
test.it('should save edits on enter', function () { test.it('should save edits on enter', function () {
createStandardItems();
page.doubleClickItemAtIndex(1);
page.editItemAtIndex(1, 'buy some sausages' + webdriver.Key.ENTER); page.editItemAtIndex(1, 'buy some sausages' + webdriver.Key.ENTER);
testOps.assertItems([TODO_ITEM_ONE, 'buy some sausages', TODO_ITEM_THREE]); testOps.assertItems([TODO_ITEM_ONE, 'buy some sausages', TODO_ITEM_THREE]);
}); });
test.it('should save edits on blur', function () { test.it('should save edits on blur', function () {
createStandardItems();
page.doubleClickItemAtIndex(1);
page.editItemAtIndex(1, 'buy some sausages'); page.editItemAtIndex(1, 'buy some sausages');
// click a toggle button so that the blur() event is fired // click a toggle button so that the blur() event is fired
...@@ -233,27 +229,18 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -233,27 +229,18 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
}); });
test.it('should trim entered text', function () { test.it('should trim entered text', function () {
createStandardItems();
page.doubleClickItemAtIndex(1);
page.editItemAtIndex(1, ' buy some sausages ' + webdriver.Key.ENTER); page.editItemAtIndex(1, ' buy some sausages ' + webdriver.Key.ENTER);
testOps.assertItems([TODO_ITEM_ONE, 'buy some sausages', TODO_ITEM_THREE]); testOps.assertItems([TODO_ITEM_ONE, 'buy some sausages', TODO_ITEM_THREE]);
}); });
test.it('should remove the item if an empty text string was entered', function () { test.it('should remove the item if an empty text string was entered', function () {
createStandardItems();
page.doubleClickItemAtIndex(1);
page.editItemAtIndex(1, webdriver.Key.ENTER); page.editItemAtIndex(1, webdriver.Key.ENTER);
testOps.assertItems([TODO_ITEM_ONE, TODO_ITEM_THREE]); testOps.assertItems([TODO_ITEM_ONE, TODO_ITEM_THREE]);
}); });
test.it('should cancel edits on escape', function () { test.it('should cancel edits on escape', function () {
createStandardItems();
page.doubleClickItemAtIndex(1);
page.editItemAtIndex(1, 'foo' + webdriver.Key.ESCAPE); page.editItemAtIndex(1, 'foo' + webdriver.Key.ESCAPE);
testOps.assertItems([TODO_ITEM_ONE, TODO_ITEM_TWO, TODO_ITEM_THREE]); testOps.assertItems([TODO_ITEM_ONE, TODO_ITEM_TWO, TODO_ITEM_THREE]);
......
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