Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Refactor preferences test.
Browse files Browse the repository at this point in the history
  • Loading branch information
atdrago committed May 21, 2016
1 parent 86c8368 commit dfffdc4
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions test/tests/menu/negative/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,36 +44,36 @@ describe('Negative > Preferences', function () {
.then(() => app.client.windowHandles())
.then((handles) => {
windowHandles = handles.value;
app.client.window(windowHandles[1])
// Focus the Preferences window
return app.client.window(windowHandles[1]);
})
.then(() => {
// Get "Show tips" checkbox value
return app.client.selectorExecute(TIPS_ID, (elements) => {
return elements[0].checked;
});
})
})
.then((isChecked) => {
originalIsChecked = isChecked;

if (!isChecked) {
return app.client.leftClick(TIPS_ID);
}
return assert.isTrue(isChecked, '"Show tips" checkbox should default to checked.');
})
// Focus the Negative window
.then(() => app.client.window(windowHandles[0]))
.then(() => {
// Get the class that is toggled by the "Show tips" checkbox
return app.client.selectorExecute('//body', (elements) => {
return elements[0].classList.contains('no-tips');
})
});
})
.then((hasNoTipsClass) => assert.isFalse(hasNoTipsClass))
.then((hasNoTipsClass) => assert.isFalse(hasNoTipsClass, 'The body element should not have the .no-tips class when "Show tips" is checked.'))
.then(() => app.client.window(windowHandles[1]))
.then(() => app.client.leftClick(TIPS_ID))
.then(() => app.client.window(windowHandles[0]))
.then(() => {
return app.client.selectorExecute('//body', (elements) => {
return elements[0].classList.contains('no-tips');
})
});
})
.then((hasNoTipsClass) => assert.isTrue(hasNoTipsClass));
.then((hasNoTipsClass) => assert.isTrue(hasNoTipsClass, 'The body element should have the .no-tips class when "Show tips" is checked.'));
});

// @TODO - Close should be tested here, but because it uses
Expand Down

0 comments on commit dfffdc4

Please sign in to comment.