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

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

Issue 6439460933730304: Issue 616 - Add tests for $generichide and $genericblock (Closed)
Left Patch Set: Addressed The Professor's feedback! Created Oct. 2, 2015, 10:17 a.m.
Right Patch Set: Couple more tweaks Created Oct. 2, 2015, 10:37 a.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 | chrome/content/tests/filterClasses.js » ('j') | 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 server = null; 3 let server = null;
4 let frame = null; 4 let frame = null;
5 5
6 module("Element hiding", { 6 module("Element hiding", {
7 setup: function() 7 setup: function()
8 { 8 {
9 prepareFilterComponents.call(this); 9 prepareFilterComponents.call(this);
10 preparePrefs.call(this); 10 preparePrefs.call(this);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 { 139 {
140 let doc = frame.contentDocument; 140 let doc = frame.contentDocument;
141 equal(doc.getElementById("test1").offsetHeight > 0 ? "visible" : "hidd en", expected[0], "First element visible"); 141 equal(doc.getElementById("test1").offsetHeight > 0 ? "visible" : "hidd en", expected[0], "First element visible");
142 equal(doc.getElementById("test2").offsetHeight > 0 ? "visible" : "hidd en", expected[1], "Second element visible"); 142 equal(doc.getElementById("test2").offsetHeight > 0 ? "visible" : "hidd en", expected[1], "Second element visible");
143 143
144 start(); 144 start();
145 }); 145 });
146 }, false, true); 146 }, false, true);
147 frame.setAttribute("src", "http://localhost:1234/test"); 147 frame.setAttribute("src", "http://localhost:1234/test");
148 }; 148 };
149 FilterNotifier.addListener(listener);
149 150
150 for (let filter_text of filters) 151 for (let filter_text of filters)
151 { 152 {
152 let filter = Filter.fromText(filter_text); 153 let filter = Filter.fromText(filter_text);
153 if (filter instanceof WhitelistFilter) 154 if (filter instanceof WhitelistFilter)
154 defaultMatcher.add(filter); 155 defaultMatcher.add(filter);
155 else 156 else
156 ElemHide.add(filter); 157 ElemHide.add(filter);
157 } 158 }
158 159
159 FilterNotifier.addListener(listener);
160 ElemHide.isDirty = true; 160 ElemHide.isDirty = true;
161 ElemHide.apply(); 161 ElemHide.apply();
162 } 162 }
163 163
164 let stageDescriptions = { 164 let stageDescriptions = {
165 1: "running without exceptions", 165 1: "running without exceptions",
166 2: "running with whitelisted document", 166 2: "running with whitelisted document",
167 3: "running with exception not applying to documents", 167 3: "running with exception not applying to documents",
168 4: "running with element hiding exception", 168 4: "running with element hiding exception",
169 }; 169 };
170 170
171 for (let test = 0; test < tests.length; test++) 171 for (let test = 0; test < tests.length; test++)
172 { 172 {
173 let [filters, expected] = tests[test]; 173 let [filters, expected] = tests[test];
174 for (let stage = 1; stage in stageDescriptions; stage++) 174 for (let stage = 1; stage in stageDescriptions; stage++)
175 asyncTest(filters.join(", ") + " (" + stageDescriptions[stage] + ")", runT est.bind(null, tests[test], stage)); 175 asyncTest(filters.join(", ") + " (" + stageDescriptions[stage] + ")", runT est.bind(null, tests[test], stage));
176 } 176 }
177 })(); 177 })();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld