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

Side by Side Diff: pages/filters/ping.tmpl

Issue 29755578: Issue 2148 - Rewrite the testpages test suite (Closed)
Patch Set: Created April 18, 2018, 11:54 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 title = $ping - ABP Test Pages
kzar 2018/04/19 13:08:20 Nit: Instead of hard-coding " - ABP Test Pages" on
2 template = testcase
3
4 {% set testcase_moreinfo = [
5 ("Filter Options", "https://adblockplus.org/filters#options"),
6 ] %}
7
8
9 <script>
10 function pagelog(message) {
11 var log = document.getElementById("testcase-fo-ping");
12 log.innerText = log.innerText + message + "\n";
13 console.log(message);
14 }
15
16 function do_ping() {
17 var button = document.getElementById("ping-button");
18 button.parentNode.removeChild(button);
19
20 pagelog( "Calling navigator.sendBeacon()" );
kzar 2018/04/19 13:08:21 Nit: In JavaScript code we generally don't put whi
21 var res = navigator.sendBeacon("/en/filters/ping", "Testdata" );
22 pagelog("navigator.sendBeacon() called.");
23
24 (res ? pagelog("navigator.sendBeacon() returned true.") : pagelog("Beacon coul d not be queued."));
kzar 2018/04/19 13:08:20 Nit: Please use a regular if... else here, since y
25 }
26 </script>
27
28 <section class="site-panel">
29 <h2>$ping</h2>
30 <p>Check that usage of the $ping filter option is working as expected.</p>
31 <p>Note: Browsers will always return true if the ping is successfully queued, not if sent. Check with the Adblock Plus DevTools panel to check if it was actua lly blocked.</p>
32 </section>
33
34 <section class="site-panel">
35 <h2>Test case</h2>
36 <div class="testcase-container">
37 <div class="testcase-row"><h3>Ping</h3>
38 <a href="http://example.com" target="_blank" ping="/en/filters/ping">Link based ping</a>
39 </div>
40 </div>
41 <h3>Filters</h3>
42 testpages.adblockplus.org/*^$ping
43 </section>
44
45 <section class="site-panel">
46 <h2>navigator.sendBeacon()</h2>
47 <div class="testcase-container">
48 <div class="testcase-row"><h3>Ping</h3>
49 <div id="testcase-fo-ping">
50 <button id="ping-button" onclick="do_ping()">Send Ping</button>
51 </div>
52 </div>
53 </div>
54 <h3>Filters</h3>
55 testpages.adblockplus.org/*^$ping
56 </section>
OLDNEW

Powered by Google App Engine
This is Rietveld