1
var pwd = process.cwd();
2
var helper = require('../integration_test_helper.js');
4
// this test uses custom HTML because PhantomJS
5
// has problems showing alert modal dialogs.
6
// We are testing callbacks against simple DOM
7
// manipulations instead.
9
'Clicking on disabled item has no effect': function (test) {
11
.open('file://' + pwd + '/demo/disabled-changing_test.html')
12
.execute(helper.rightClick, '.context-menu-one')
13
.waitForElement('#context-menu-layer')
15
.assert.numberOfElements('.context-menu-root li')
16
.is(3, '3 context menu items are shown')
17
.click('.context-menu-root li:nth-child(2)')
18
.assert.text('#msg', '', 'Disabled menu item didnt set text')
22
'Toggle disabled item status': function (test) {
24
.open('file://' + pwd + '/demo/disabled-changing_test.html')
25
.execute(helper.rightClick, '.context-menu-one')
26
.waitForElement('#context-menu-layer')
28
.click('.context-menu-root li:nth-child(3)')
29
.assert.doesntExist('.context-menu-root .disabled', 'All menu items are enabled')
30
.click('.context-menu-root li:nth-child(2)')
31
.assert.text('#msg', 'clicked: cut', 'Enabled menu item sets text')
35
'Toggled status is saved after menu is closed': function (test) {
37
.open('file://' + pwd + '/demo/disabled-changing_test.html')
38
.execute(helper.rightClick, '.context-menu-one')
39
.waitForElement('#context-menu-layer')
41
.click('.context-menu-root li:nth-child(3)')
42
.assert.doesntExist('.context-menu-root .disabled', 'All menu items are enabled')
43
.execute(helper.closeMenu, '.context-menu-one')
45
.execute(helper.rightClick, '.context-menu-one')
46
.waitForElement('#context-menu-layer')
48
.assert.doesntExist('.context-menu-root .disabled', 'All menu items are still enabled')