Skip to content

Commit f37a9e6

Browse files
authored
Merge pull request #161 from rackerlabs/SURF-848-typography-tests
Surf 848 typography tests
2 parents 986a1c2 + 4000971 commit f37a9e6

File tree

7 files changed

+589
-27
lines changed

7 files changed

+589
-27
lines changed

docs/components/typography/index.html

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{% block content %}
66
<section><!-- Typefaces -->
77
<h2 id="typefaces">Typefaces</h2>
8-
<div class="demo demo-typography">
8+
<div class="demo demo-typography" data-visreg="typography-typefaces">
99
<div class="hxRow">
1010
<div class="hxCol font-roboto">
1111
<p class="weight-thin">100: Roboto Thin</p>
@@ -27,7 +27,7 @@ <h2 id="typefaces">Typefaces</h2>
2727

2828
<section><!-- Headings -->
2929
<h2 id="headers">Headings</h2>
30-
<div class="demo">
30+
<div class="demo" data-visreg="typography-headings">
3131
<h1>Heading One</h1>
3232
<h2>Heading Two</h2>
3333
<h3>Heading Three</h3>
@@ -83,7 +83,7 @@ <h2 id="subdued">Subdued</h2>
8383
muted appearance.
8484
</p>
8585

86-
<div class="demo">
86+
<div class="demo" data-visreg="typography-subdued">
8787
<span class="hxSubdued">Subdued</span>
8888
</div>
8989
{% code 'html' %}
@@ -103,7 +103,7 @@ <h2 id="caption">Caption</h2>
103103
the "caption" style.
104104
</p>
105105

106-
<div class="demo">
106+
<div class="demo" data-visreg="typography-caption">
107107
<p class="hxCaption">Caption</p>
108108
</div>
109109
{% code 'html' %}
@@ -127,7 +127,7 @@ <h2 id="sub-body">Sub-Body</h2>
127127
"sub-body" style.
128128
</p>
129129

130-
<div class="demo">
130+
<div class="demo" data-visreg="typography-sub-body">
131131
<p class="hxSubBody">Sub-Body</p>
132132
</div>
133133
{% code 'html' %}
@@ -152,7 +152,7 @@ <h2 id="links">Links</h2>
152152
</div>
153153
</div>
154154

155-
<div class="demo">
155+
<div class="demo" data-visreg="typography-link">
156156
<ul>
157157
<li><a href="#">Normal Link</a></li>
158158
<li><a href="#" class="pseudo-active">Pressed Link</a></li>
@@ -167,7 +167,7 @@ <h2 id="inline-code">Inline Code</h2>
167167
text from code snippets.
168168
</p>
169169

170-
<div class="demo">
170+
<div class="demo" data-visreg="typography-inline-code">
171171
<p>
172172
Add an event listener with the <code>EventTarget.addEventListener()</code> function.
173173
</p>
@@ -185,7 +185,7 @@ <h2 id="keyboard">Keyboard</h2>
185185
Use the <code>&lt;kbd&gt;</code> element to differentiate descriptive text
186186
from instructional key presses.
187187
</p>
188-
<div class="demo">
188+
<div class="demo" data-visreg="typography-keyboard">
189189
<p>
190190
Press <kbd>Ctrl+Z</kbd> (<kbd>Command+Z</kbd> on Mac)
191191
to undo the most recent action.
@@ -213,7 +213,7 @@ <h2 id="code-block">Code Block</h2>
213213
<section><!-- Error Message -->
214214
<h2 id="error-message">Error Message</h2>
215215

216-
<div class="demo">
216+
<div class="demo" data-visreg="typography-error-message">
217217
<hx-error>Error message goes here</hx-error>
218218
</div>
219219
{% code 'html' %}
@@ -234,7 +234,7 @@ <h2 id="syntax-highlighting">Syntax Highlighting</h2>
234234
Below are some examples of the syntax highlighting in action.
235235
</p>
236236

237-
<figure>
237+
<figure data-visreg="typography-syntax-html">
238238
<figcaption>HTML Syntax Highlighting Example</figcaption>
239239
{% code 'html' %}
240240
<script type="text/javascript" src="path/to/script.js"></script>
@@ -262,7 +262,7 @@ <h2 id="syntax-highlighting">Syntax Highlighting</h2>
262262
{% endcode %}
263263
</figure>
264264

265-
<figure>
265+
<figure data-visreg="typography-syntax-js">
266266
<figcaption>JavaScript Syntax Highlighting Example</figcaption>
267267
{% code 'javascript' %}
268268
/**
@@ -292,7 +292,7 @@ <h2 id="syntax-highlighting">Syntax Highlighting</h2>
292292
{% endcode %}
293293
</figure>
294294

295-
<figure>
295+
<figure data-visreg="typography-syntax-css">
296296
<figcaption>CSS Syntax Highlighting Example</figcaption>
297297
{% code 'css' %}
298298
/* CSS Comment */
@@ -323,7 +323,7 @@ <h2 id="syntax-highlighting">Syntax Highlighting</h2>
323323
{% endcode %}
324324
</figure>
325325

326-
<figure>
326+
<figure data-visreg="typography-syntax-diff">
327327
<figcaption>diff Syntax Highlighting Example</figcaption>
328328
{% code 'diff' %}
329329
Index: languages/ini.js
@@ -359,7 +359,7 @@ <h2 id="syntax-highlighting">Syntax Highlighting</h2>
359359
{% endcode %}
360360
</figure>
361361

362-
<figure>
362+
<figure data-visreg="typography-syntax-bash">
363363
<figcaption>bash Syntax Highlighting Example</figcaption>
364364
{% code 'bash' %}
365365
#!/bin/bash
@@ -380,7 +380,7 @@ <h2 id="syntax-highlighting">Syntax Highlighting</h2>
380380
{% endcode %}
381381
</figure>
382382

383-
<figure>
383+
<figure data-visreg="typography-syntax-ini">
384384
<figcaption>.ini Syntax Highlighting Example</figcaption>
385385
{% code 'ini' %}
386386
; boilerplate
@@ -398,7 +398,7 @@ <h2 id="syntax-highlighting">Syntax Highlighting</h2>
398398
{% endcode %}
399399
</figure>
400400

401-
<figure>
401+
<figure data-visreg="typography-syntax-markdown">
402402
<figcaption>Markdown Syntax Highlighting Example</figcaption>
403403
{% code 'markdown' %}
404404
# hello world

test/common/util.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@ export async function sleep(ms = 1500) {
1616
});
1717
}
1818

19+
export async function webComponentsReady(driver: WebDriver) {
20+
const ready = async () => (await driver.executeScript("return window.WebComponents.ready")) as boolean;
21+
while (!await ready()) {
22+
await sleep(100);
23+
}
24+
}
25+
1926
export async function snapshot(t: TestContext, element: WebElement) {
2027
if (process.env.TRAVIS) {
21-
const ready = async () => (await element.getDriver().executeScript("return window.WebComponents.ready")) as boolean;
22-
while (!(await ready())) {
23-
await sleep(100);
24-
}
28+
await webComponentsReady(element.getDriver());
2529
}
2630

2731
t.snapshot(await element.getAttribute("outerHTML"));

test/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"lint": "tslint -c tslint.json visreg/",
2323
"pretest": "npm run build",
2424
"test": "npm run test:regression && npm run test:visreg",
25-
"test:regression": "ava node built/regression/generateRegressionTests.js --verbose",
25+
"test:regression": "ava node built/regression/generateRegressionTests.js --verbose --serial",
2626
"test:visreg": "ava built/visreg/{chrome,firefox}.js --verbose --serial",
2727
"postinstall": "[ -f bin/visreg.config.ts ] || cp bin/visreg.example.config.ts bin/visreg.config.ts",
2828
"previsreg": "npm run clean:visreg",

0 commit comments

Comments
 (0)