Commit e0a32741 authored by Oskar Gustafsson's avatar Oskar Gustafsson Committed by Sam Saccone

Fix JSCS errors (#1647)

parent 1de4f1a4
...@@ -171,8 +171,9 @@ module.exports = function Page(browser) { ...@@ -171,8 +171,9 @@ module.exports = function Page(browser) {
// PAGE ACTIONS // PAGE ACTIONS
this.ensureAppIsVisibleAndLoaded = function () { this.ensureAppIsVisibleAndLoaded = function () {
return this.waitForVisibility(false, this.getFooterSectionCss(), 'Footer is not hidden') // Footer hidden -> app is active return this.waitForVisibility(false, this.getFooterSectionCss(), 'Footer is not hidden')
.then(this.waitForElement.bind(this, '.new-todo, #new-todo', 'Could not find new todo input field', undefined)) .then(this.waitForElement.bind(
this, '.new-todo, #new-todo', 'Could not find new todo input field', undefined))
.then(function (newTodoElement) { .then(function (newTodoElement) {
return newTodoElement.getAttribute('id'); return newTodoElement.getAttribute('id');
}) })
...@@ -188,7 +189,8 @@ module.exports = function Page(browser) { ...@@ -188,7 +189,8 @@ module.exports = function Page(browser) {
}; };
this.clickClearCompleteButton = function () { this.clickClearCompleteButton = function () {
return this.waitForVisibility(true, this.getClearCompletedButtonCss(), 'Expected clear completed items button to be visible') return this.waitForVisibility(true, this.getClearCompletedButtonCss(),
'Expected clear completed items button to be visible')
.then(function (clearCompleteButton) { .then(function (clearCompleteButton) {
clearCompleteButton.click(); clearCompleteButton.click();
}); });
...@@ -218,7 +220,8 @@ module.exports = function Page(browser) { ...@@ -218,7 +220,8 @@ module.exports = function Page(browser) {
.then(function () { .then(function () {
return self.waitForElement(self.getLastListItemLabelCss(nItems)); return self.waitForElement(self.getLastListItemLabelCss(nItems));
}) })
.then(this.waitForTextContent.bind(this, itemText.trim(), 'Expected new item label to read ' + itemText.trim())); .then(this.waitForTextContent.bind(this, itemText.trim(),
'Expected new item label to read ' + itemText.trim()));
}; };
this.toggleItemAtIndex = function (index) { this.toggleItemAtIndex = function (index) {
......
...@@ -18,7 +18,7 @@ module.exports = function PageLaxMode() { ...@@ -18,7 +18,7 @@ module.exports = function PageLaxMode() {
return [ return [
'section > ul', 'section > ul',
'section > div > ul', 'section > div > ul',
'ul#todo-list', 'ul#todo-list'
].map(function (listCss) { ].map(function (listCss) {
return listCss + (suffixCss || ''); return listCss + (suffixCss || '');
}).join(', '); }).join(', ');
...@@ -28,7 +28,7 @@ module.exports = function PageLaxMode() { ...@@ -28,7 +28,7 @@ module.exports = function PageLaxMode() {
return [ return [
'section > input[type="checkbox"]', 'section > input[type="checkbox"]',
'section > * > input[type="checkbox"]', 'section > * > input[type="checkbox"]',
'input#toggle-all', 'input#toggle-all'
].join(', '); ].join(', ');
}; };
...@@ -36,14 +36,14 @@ module.exports = function PageLaxMode() { ...@@ -36,14 +36,14 @@ module.exports = function PageLaxMode() {
return [ return [
'footer > button', 'footer > button',
'footer > * > button', 'footer > * > button',
'button#clear-completed', 'button#clear-completed'
].join(', '); ].join(', ');
}; };
this.getItemCountCss = function () { this.getItemCountCss = function () {
return [ return [
'footer > span', 'footer > span',
'footer > * > span', 'footer > * > span'
].join(', '); ].join(', ');
}; };
...@@ -55,7 +55,7 @@ module.exports = function PageLaxMode() { ...@@ -55,7 +55,7 @@ module.exports = function PageLaxMode() {
return [ return [
'header > input', 'header > input',
'header > * > input', 'header > * > input',
'input#new-todo', 'input#new-todo'
].join(', '); ].join(', ');
}; };
...@@ -66,7 +66,7 @@ module.exports = function PageLaxMode() { ...@@ -66,7 +66,7 @@ module.exports = function PageLaxMode() {
this.getListItemInputCss = function (index) { this.getListItemInputCss = function (index) {
return [ return [
this.getListItemCss(index, ' input.edit'), this.getListItemCss(index, ' input.edit'),
this.getListItemCss(index, ' input[type="text"]'), this.getListItemCss(index, ' input[type="text"]')
].join(', '); ].join(', ');
}; };
......
...@@ -114,9 +114,9 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -114,9 +114,9 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
test.it('should allow me to add todo items', function (done) { test.it('should allow me to add todo items', function (done) {
page.enterItem(TODO_ITEM_ONE); page.enterItem(TODO_ITEM_ONE);
testOps.assertItems([ TODO_ITEM_ONE ]); testOps.assertItems([TODO_ITEM_ONE]);
page.enterItem(TODO_ITEM_TWO); page.enterItem(TODO_ITEM_TWO);
testOps.assertItems([ TODO_ITEM_ONE, TODO_ITEM_TWO ]) testOps.assertItems([TODO_ITEM_ONE, TODO_ITEM_TWO])
.then(function () { done(); }); .then(function () { done(); });
}); });
...@@ -156,7 +156,7 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -156,7 +156,7 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
test.it('should allow me to mark all items as completed', function (done) { test.it('should allow me to mark all items as completed', function (done) {
page.clickMarkAllCompletedCheckBox(); page.clickMarkAllCompletedCheckBox();
testOps.assertItemCompletedStates([ true, true, true ]) testOps.assertItemCompletedStates([true, true, true])
.then(function () { done(); }); .then(function () { done(); });
}); });
...@@ -175,7 +175,7 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -175,7 +175,7 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
page.clickMarkAllCompletedCheckBox(); page.clickMarkAllCompletedCheckBox();
page.clickMarkAllCompletedCheckBox(); page.clickMarkAllCompletedCheckBox();
testOps.assertItemCompletedStates([ false, false, false ]) testOps.assertItemCompletedStates([false, false, false])
.then(function () { done(); }); .then(function () { done(); });
}); });
...@@ -202,10 +202,10 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -202,10 +202,10 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
page.enterItem(TODO_ITEM_TWO); page.enterItem(TODO_ITEM_TWO);
page.toggleItemAtIndex(0); page.toggleItemAtIndex(0);
testOps.assertItemCompletedStates([ true, false ]); testOps.assertItemCompletedStates([true, false]);
page.toggleItemAtIndex(1); page.toggleItemAtIndex(1);
testOps.assertItemCompletedStates([ true, true ]) testOps.assertItemCompletedStates([true, true])
.then(function () { done(); }); .then(function () { done(); });
}); });
...@@ -214,10 +214,10 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -214,10 +214,10 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
page.enterItem(TODO_ITEM_TWO); page.enterItem(TODO_ITEM_TWO);
page.toggleItemAtIndex(0); page.toggleItemAtIndex(0);
testOps.assertItemCompletedStates([ true, false ]); testOps.assertItemCompletedStates([true, false]);
page.toggleItemAtIndex(0); page.toggleItemAtIndex(0);
testOps.assertItemCompletedStates([ false, false ]) testOps.assertItemCompletedStates([false, false])
.then(function () { done(); }); .then(function () { done(); });
}); });
...@@ -245,7 +245,7 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -245,7 +245,7 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
test.it('should save edits on enter', function (done) { test.it('should save edits on enter', function (done) {
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])
.then(function () { done(); }); .then(function () { done(); });
}); });
...@@ -253,25 +253,25 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -253,25 +253,25 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
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
page.toggleItemAtIndex(0); page.toggleItemAtIndex(0);
testOps.assertItems([ TODO_ITEM_ONE, 'buy some sausages', TODO_ITEM_THREE ]) testOps.assertItems([TODO_ITEM_ONE, 'buy some sausages', TODO_ITEM_THREE])
.then(function () { done(); }); .then(function () { done(); });
}); });
test.it('should trim entered text', function (done) { test.it('should trim entered text', function (done) {
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])
.then(function () { done(); }); .then(function () { done(); });
}); });
test.it('should remove the item if an empty text string was entered', function (done) { test.it('should remove the item if an empty text string was entered', function (done) {
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])
.then(function () { done(); }); .then(function () { done(); });
}); });
test.it('should cancel edits on escape', function (done) { test.it('should cancel edits on escape', function (done) {
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])
.then(function () { done(); }); .then(function () { done(); });
}); });
...@@ -303,7 +303,7 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -303,7 +303,7 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
page.toggleItemAtIndex(1); page.toggleItemAtIndex(1);
page.clickClearCompleteButton(); page.clickClearCompleteButton();
testOps.assertItemCount(2); testOps.assertItemCount(2);
testOps.assertItems([ TODO_ITEM_ONE, TODO_ITEM_THREE ]) testOps.assertItems([TODO_ITEM_ONE, TODO_ITEM_THREE])
.then(function () { done(); }); .then(function () { done(); });
}); });
...@@ -322,8 +322,8 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -322,8 +322,8 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
test.it('should persist its data', function (done) { test.it('should persist its data', function (done) {
function stateTest() { function stateTest() {
testOps.assertItemCount(2); testOps.assertItemCount(2);
testOps.assertItems([ TODO_ITEM_ONE, TODO_ITEM_TWO ]); testOps.assertItems([TODO_ITEM_ONE, TODO_ITEM_TWO]);
return testOps.assertItemCompletedStates([ false, true ]); return testOps.assertItemCompletedStates([false, true]);
} }
// set up state // set up state
...@@ -350,7 +350,7 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -350,7 +350,7 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
test.it('should allow me to display active items', function (done) { test.it('should allow me to display active items', function (done) {
page.toggleItemAtIndex(1); page.toggleItemAtIndex(1);
page.filterByActiveItems(); page.filterByActiveItems();
testOps.assertItems([ TODO_ITEM_ONE, page.ITEM_HIDDEN_OR_REMOVED, TODO_ITEM_THREE ]) testOps.assertItems([TODO_ITEM_ONE, page.ITEM_HIDDEN_OR_REMOVED, TODO_ITEM_THREE])
.then(function () { return done(); }); .then(function () { return done(); });
}); });
...@@ -358,18 +358,18 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -358,18 +358,18 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
page.toggleItemAtIndex(1); page.toggleItemAtIndex(1);
page.filterByActiveItems(); page.filterByActiveItems();
page.filterByCompletedItems(); page.filterByCompletedItems();
testOps.assertItems([ page.ITEM_HIDDEN_OR_REMOVED, TODO_ITEM_TWO ]); // should show completed items testOps.assertItems([page.ITEM_HIDDEN_OR_REMOVED, TODO_ITEM_TWO]); // should show completed items
page.back(); // then active items page.back(); // then active items
testOps.assertItems([ TODO_ITEM_ONE, page.ITEM_HIDDEN_OR_REMOVED, TODO_ITEM_THREE ]); testOps.assertItems([TODO_ITEM_ONE, page.ITEM_HIDDEN_OR_REMOVED, TODO_ITEM_THREE]);
page.back(); // then all items page.back(); // then all items
testOps.assertItems([ TODO_ITEM_ONE, TODO_ITEM_TWO, TODO_ITEM_THREE ]) testOps.assertItems([TODO_ITEM_ONE, TODO_ITEM_TWO, TODO_ITEM_THREE])
.then(function () { done(); }); .then(function () { done(); });
}); });
test.it('should allow me to display completed items', function (done) { test.it('should allow me to display completed items', function (done) {
page.toggleItemAtIndex(1); page.toggleItemAtIndex(1);
page.filterByCompletedItems(); page.filterByCompletedItems();
testOps.assertItems([ page.ITEM_HIDDEN_OR_REMOVED, TODO_ITEM_TWO ]); testOps.assertItems([page.ITEM_HIDDEN_OR_REMOVED, TODO_ITEM_TWO]);
page.filterByAllItems() // TODO: why page.filterByAllItems() // TODO: why
.then(function () { done(); }); .then(function () { done(); });
}); });
...@@ -381,7 +381,7 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -381,7 +381,7 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
page.filterByActiveItems(); page.filterByActiveItems();
page.filterByCompletedItems(); page.filterByCompletedItems();
page.filterByAllItems(); page.filterByAllItems();
testOps.assertItems([ TODO_ITEM_ONE, TODO_ITEM_TWO, TODO_ITEM_THREE ]) testOps.assertItems([TODO_ITEM_ONE, TODO_ITEM_TWO, TODO_ITEM_THREE])
.then(function () { done(); }); .then(function () { done(); });
}); });
......
...@@ -41,7 +41,8 @@ function TestOperations(page) { ...@@ -41,7 +41,8 @@ function TestOperations(page) {
}; };
this.assertItemToggleIsHidden = function (index) { this.assertItemToggleIsHidden = function (index) {
return page.waitForVisibility(false, page.getListItemToggleCss(index), 'Expected the item toggle button to be hidden'); return page.waitForVisibility(false, page.getListItemToggleCss(index),
'Expected the item toggle button to be hidden');
}; };
this.assertItemLabelIsHidden = function (index) { this.assertItemLabelIsHidden = function (index) {
...@@ -50,7 +51,8 @@ function TestOperations(page) { ...@@ -50,7 +51,8 @@ function TestOperations(page) {
this.assertNewItemInputFieldText = function (text) { this.assertNewItemInputFieldText = function (text) {
return page.waitForNewItemInputField() return page.waitForNewItemInputField()
.then(page.waitForTextContent.bind(page, text, 'Expected the new item input text field contents to be ' + text)); .then(page.waitForTextContent.bind(page, text,
'Expected the new item input text field contents to be ' + text));
}; };
this.assertItemText = function (itemIndex, text) { this.assertItemText = function (itemIndex, text) {
......
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