Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: chrome/content/tests/ui/icon_position.js

Issue 5390879414026240: Issue 101 - Fix icon tests (Closed)
Left Patch Set: reverted wrong change, sorry! Created July 31, 2014, 11:14 a.m.
Right Patch Set: fixed comments Created July 31, 2014, 12:13 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 (function() 1 (function()
2 { 2 {
3 let {application} = require("info"); 3 let {application} = require("info");
4 if (application != "firefox") 4 if (application != "firefox")
5 return; 5 return;
6 6
7 let CustomizableUI = null; 7 let CustomizableUI = null;
8 let usingShim = false; 8 let usingShim = false;
9 try 9 try
10 { 10 {
11 ({CustomizableUI}) = Cu.import("resource:///modules/CustomizableUI.jsm", nul l); 11 ({CustomizableUI}) = Cu.import("resource:///modules/CustomizableUI.jsm", nul l);
12 } 12 }
13 catch (e) 13 catch (e)
14 { 14 {
15 usingShim = true; 15 usingShim = true;
16 // No built-in CustomizableUI API, use our own implementation. 16 // No built-in CustomizableUI API, use our own implementation.
17 ({CustomizableUI}) = require("customizableUI"); 17 ({CustomizableUI}) = require("customizableUI");
18 } 18 }
19 19
20 let wnd = Utils.getChromeWindow(window); 20 let wnd = Utils.getChromeWindow(window);
21 let toolbox = wnd.document.getElementById("navigator-toolbox"); 21 let defaultParent = require("appSupport").defaultToolbarPosition.parent;
22 if (!toolbox) 22
23 return; 23 let toolbox;
Wladimir Palant 2014/07/31 11:36:15 This is only relevant when we are using the shim -
24 if (usingShim)
25 {
26 let toolbar = wnd.document.getElementById(defaultParent);
27 if (!toolbar)
28 return;
29 toolbox = toolbar.toolbox;
30 }
24 31
25 module("Icon position", { 32 module("Icon position", {
26 setup: function() 33 setup: function()
27 { 34 {
28 // Force default position 35 // Force default position
29 if (usingShim) 36 if (usingShim)
30 toolbox.removeAttribute("abp-iconposition"); 37 toolbox.removeAttribute("abp-iconposition");
31 38
32 if (UI.isToolbarIconVisible(wnd)) 39 if (UI.isToolbarIconVisible(wnd))
33 UI.toggleToolbarIcon(); 40 UI.toggleToolbarIcon();
34 }, 41 },
35 teardown: function() 42 teardown: function()
36 { 43 {
37 UI.toggleToolbarIcon(); 44 UI.toggleToolbarIcon();
38 UI.toggleToolbarIcon(); 45 UI.toggleToolbarIcon();
39 } 46 }
40 }); 47 });
41 48
42 test("Put icon at default position", function() 49 test("Put icon at default position", function()
43 { 50 {
44 const DEFUALT = require("appSupport").defaultToolbarPosition.parent;
Wladimir Palant 2014/07/31 11:36:15 This is misspelled. Still, I would prefer a proper
45
46 UI.toggleToolbarIcon(); 51 UI.toggleToolbarIcon();
47 let placement = CustomizableUI.getPlacementOfWidget("abp-toolbarbutton"); 52 let placement = CustomizableUI.getPlacementOfWidget("abp-toolbarbutton");
48 ok(placement, "Button is visible"); 53 ok(placement, "Button is visible");
49 if (placement) 54 if (placement)
50 equal(placement.area, DEFUALT, "Button is at the right position"); 55 equal(placement.area, defaultParent, "Button is at the right position");
51 56
52 UI.toggleToolbarIcon(); 57 UI.toggleToolbarIcon();
53 placement = CustomizableUI.getPlacementOfWidget("abp-toolbarbutton"); 58 placement = CustomizableUI.getPlacementOfWidget("abp-toolbarbutton");
54 ok(!placement, "Button is invisible"); 59 ok(!placement, "Button is invisible");
55 60
56 UI.toggleToolbarIcon(); 61 UI.toggleToolbarIcon();
57 placement = CustomizableUI.getPlacementOfWidget("abp-toolbarbutton"); 62 placement = CustomizableUI.getPlacementOfWidget("abp-toolbarbutton");
58 ok(placement, "Button is visible"); 63 ok(placement, "Button is visible");
59 if (placement) 64 if (placement)
60 equal(placement.area, DEFUALT, "Button is at the right position again"); 65 equal(placement.area, defaultParent, "Button is at the right position agai n");
61 }); 66 });
62 67
63 test("Move icon into tabs bar and restore", function() 68 test("Move icon into tabs bar and restore", function()
64 { 69 {
65 // The shim doesn't have proper support for addToWidgetArea 70 // The shim doesn't have proper support for addToWidgetArea
66 if (usingShim) { 71 if (usingShim) {
67 ok(true, "Can't test"); 72 ok(true, "Can't test");
68 return; 73 return;
69 } 74 }
70 75
(...skipping 10 matching lines...) Expand all
81 ok(!placement, "Button is invisible"); 86 ok(!placement, "Button is invisible");
82 87
83 UI.toggleToolbarIcon(); 88 UI.toggleToolbarIcon();
84 placement = CustomizableUI.getPlacementOfWidget("abp-toolbarbutton"); 89 placement = CustomizableUI.getPlacementOfWidget("abp-toolbarbutton");
85 ok(placement, "Button is visible"); 90 ok(placement, "Button is visible");
86 if (placement) 91 if (placement)
87 equal(placement.area, CustomizableUI.AREA_NAVBAR, "Button is at default po sition"); 92 equal(placement.area, CustomizableUI.AREA_NAVBAR, "Button is at default po sition");
88 }); 93 });
89 94
90 })(); 95 })();
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld