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