Debian package: Declare compliance with Debian Policy 4.3.0
[conkeror.git] / tests / simple / keymap.js
blob3e4fd5cc82c9a23ce2badca305e6be4511252175
2 require('walnut.js');
4 walnut_run({
5 test_normalize_key_combo_1: function () {
6 assert_equals(format_key_combo(unformat_key_combo("a")), "a");
7 },
8 test_normalize_key_combo_2: function () {
9 assert_equals(format_key_combo(unformat_key_combo("C-a")), "C-a");
11 test_normalize_key_combo_3: function () {
12 assert_equals(format_key_combo(unformat_key_combo("C-M-b")), "C-M-b");
14 test_normalize_key_combo_4: function () {
15 assert_equals(format_key_combo(unformat_key_combo("M-C-c")), "C-M-c");
17 test_charcode32_is_space: function () {
18 assert_equals(format_key_combo({ charCode: 32 }), "space");
20 });
22 walnut_run({
23 suite_setup: function () {
24 define_keymap("test_keymap");
26 suite_teardown: function () {
27 delete conkeror.test_keymap;
29 test_define_key_1: function () {
30 define_key(test_keymap, "C-a", "foo");
31 assert(test_keymap.bindings["C-a"]);
33 test_define_key_2: function () {
34 define_key(test_keymap, "C-M-b", "foo");
35 assert(test_keymap.bindings["C-M-b"]);
37 test_define_key_3: function () {
38 define_key(test_keymap, "M-C-c", "foo");
39 assert(test_keymap.bindings["C-M-c"]);
41 test_define_key_4: function () {
42 define_key(test_keymap, "C-a", "foo");
43 assert_equals(test_keymap.bindings["C-a"].command, "foo");
45 });
47 walnut_run({
48 setup: function () {
49 define_keymap("test_keymap");
50 define_key(test_keymap, "C-a", "foo");
52 teardown: function () {
53 delete conkeror.test_keymap;
55 test_undefine_key_1: function () {
56 undefine_key(test_keymap, "C-a");
57 assert_not(test_keymap.bindings["C-a"]);
59 test_undefine_key_2: function () {
60 define_key(test_keymap, "C-a");
61 assert_not(test_keymap.bindings["C-a"]);
63 });
65 walnut_run({
66 setup: function () {
67 define_keymap("test_keymap");
68 define_key(test_keymap, "C-a", "foo");
70 teardown: function () {
71 delete conkeror.test_keymap;
73 test_keymap_lookup_1: function () {
74 assert(keymap_lookup([test_keymap], "C-a"));
76 });