mirror of https://github.com/zulip/zulip.git
casper: Extract user_checkbox() helper.
This sets the stage to eliminate the data-email markup.
This commit is contained in:
parent
8e7ad57131
commit
a0bd93d720
|
@ -1,5 +1,9 @@
|
||||||
var common = require('../casper_lib/common.js');
|
var common = require('../casper_lib/common.js');
|
||||||
|
|
||||||
|
function user_checkbox(email) {
|
||||||
|
return '#user-checkboxes [data-email="' + email + '"]';
|
||||||
|
}
|
||||||
|
|
||||||
common.start_and_log_in();
|
common.start_and_log_in();
|
||||||
|
|
||||||
casper.then(function () {
|
casper.then(function () {
|
||||||
|
@ -27,8 +31,8 @@ casper.waitUntilVisible('.sub_unsub_button.checked', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
casper.then(function () {
|
casper.then(function () {
|
||||||
casper.test.assertExists('#user-checkboxes [data-email="cordelia@zulip.com"]', 'Original user list contains Cordelia');
|
casper.test.assertExists(user_checkbox('cordelia@zulip.com'), 'Original user list contains Cordelia');
|
||||||
casper.test.assertExists('#user-checkboxes [data-email="othello@zulip.com"]', 'Original user list contains Othello');
|
casper.test.assertExists(user_checkbox('othello@zulip.com'), 'Original user list contains Othello');
|
||||||
});
|
});
|
||||||
|
|
||||||
casper.waitUntilVisible("#copy-from-stream-expand-collapse", function () {
|
casper.waitUntilVisible("#copy-from-stream-expand-collapse", function () {
|
||||||
|
@ -45,10 +49,10 @@ casper.waitUntilVisible("form#stream_creation_form", function () {
|
||||||
casper.fill('form#stream_creation_form', {user_list_filter: 'ot'});
|
casper.fill('form#stream_creation_form', {user_list_filter: 'ot'});
|
||||||
});
|
});
|
||||||
casper.waitUntilVisible("#user-checkboxes", function () {
|
casper.waitUntilVisible("#user-checkboxes", function () {
|
||||||
casper.test.assertEquals(casper.visible('#user-checkboxes [data-email="cordelia@zulip.com"]'),
|
casper.test.assertEquals(casper.visible(user_checkbox('cordelia@zulip.com')),
|
||||||
false,
|
false,
|
||||||
"Cordelia is not visible");
|
"Cordelia is not visible");
|
||||||
casper.test.assertEquals(casper.visible('#user-checkboxes [data-email="othello@zulip.com"]'),
|
casper.test.assertEquals(casper.visible(user_checkbox('othello@zulip.com')),
|
||||||
true,
|
true,
|
||||||
"Othello is visible");
|
"Othello is visible");
|
||||||
|
|
||||||
|
@ -86,10 +90,10 @@ casper.then(function () {
|
||||||
casper.fill('form#stream_creation_form', {user_list_filter: ''});
|
casper.fill('form#stream_creation_form', {user_list_filter: ''});
|
||||||
});
|
});
|
||||||
casper.then(function () {
|
casper.then(function () {
|
||||||
casper.test.assertEquals(casper.visible('#user-checkboxes [data-email="cordelia@zulip.com"]'),
|
casper.test.assertEquals(casper.visible(user_checkbox('cordelia@zulip.com')),
|
||||||
true,
|
true,
|
||||||
"Cordelia is visible again");
|
"Cordelia is visible again");
|
||||||
casper.test.assertEquals(casper.visible('#user-checkboxes [data-email="othello@zulip.com"]'),
|
casper.test.assertEquals(casper.visible(user_checkbox('othello@zulip.com')),
|
||||||
true,
|
true,
|
||||||
"Othello is visible again");
|
"Othello is visible again");
|
||||||
casper.test.assertEquals(casper.visible('#stream-checkboxes [data-stream-name="Scotland"]'),
|
casper.test.assertEquals(casper.visible('#stream-checkboxes [data-stream-name="Scotland"]'),
|
||||||
|
|
Loading…
Reference in New Issue