~holger-seelig/cobweb.js/trunk

« back to all changes in this revision

Viewing changes to cobweb.js/lib/jquery-contextMenu/test/integration/disabled-changing.js

  • Committer: Holger Seelig
  • Date: 2017-08-22 04:53:24 UTC
  • Revision ID: holger.seelig@yahoo.de-20170822045324-4of4xxgt79669gbt
Switched to npm.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
var pwd = process.cwd();
2
 
var helper = require('../integration_test_helper.js');
3
 
 
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.
8
 
module.exports = {
9
 
  'Clicking on disabled item has no effect': function (test) {
10
 
    test
11
 
      .open('file://' + pwd + '/demo/disabled-changing_test.html')
12
 
      .execute(helper.rightClick, '.context-menu-one')
13
 
      .waitForElement('#context-menu-layer')
14
 
      .wait(100)
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')
19
 
      .done();
20
 
  },
21
 
 
22
 
  'Toggle disabled item status': function (test) {
23
 
    test
24
 
      .open('file://' + pwd + '/demo/disabled-changing_test.html')
25
 
      .execute(helper.rightClick, '.context-menu-one')
26
 
      .waitForElement('#context-menu-layer')
27
 
      .wait(100)
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')
32
 
      .done();
33
 
  },
34
 
 
35
 
  'Toggled status is saved after menu is closed': function (test) {
36
 
    test
37
 
      .open('file://' + pwd + '/demo/disabled-changing_test.html')
38
 
      .execute(helper.rightClick, '.context-menu-one')
39
 
      .waitForElement('#context-menu-layer')
40
 
      .wait(100)
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')
44
 
      .wait(100)
45
 
      .execute(helper.rightClick, '.context-menu-one')
46
 
      .waitForElement('#context-menu-layer')
47
 
      .wait(100)
48
 
      .assert.doesntExist('.context-menu-root .disabled', 'All menu items are still enabled')
49
 
      .done();
50
 
  }
51
 
};