Skip to content

Commit c499840

Browse files
author
Catherine Siller
authored
Merge pull request #514 from rackerlabs/free-friday-refactor-test-spec-files
free-friday-refactor-test-spec-files
2 parents fef46be + 23dd301 commit c499840

File tree

10 files changed

+84
-85
lines changed

10 files changed

+84
-85
lines changed

docs/components/button/test.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
label: Button
66
---
77
{% extends 'test.njk' %}
8+
{% set contentClasses = 'button-spec' %}
89

910
{% block content %}
1011
{% set variants = [

docs/components/choice-tile/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ <h2 id="basic-choice-tile">Basic Choice Tile</h2>
107107
</form>
108108
</header>
109109

110-
<div class="choice-tile-demo">
110+
<div>
111111
<label class="hxChoice">
112112
<input
113113
name="foo"

docs/components/choice-tile/test.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<section>
1111
<h2>Default</h2>
1212
<code>input + hx-tile</code>
13-
<div class="hxRow choice-tile-demo">
13+
<div class="hxRow choice-tile-spec">
1414
<!-- input -->
1515
<label class="hxChoice">
1616
<input type="radio" name="default1" />
@@ -55,7 +55,7 @@ <h2>Default</h2>
5555
<section>
5656
<h2>Subdued</h2>
5757
<code>input + hx-tile.hxSubdued</code>
58-
<div class="hxRow choice-tile-demo">
58+
<div class="hxRow choice-tile-spec">
5959
<!-- input + .hxSubdued -->
6060
<label class="hxChoice">
6161
<input type="radio" name="subdued1" />
@@ -100,7 +100,7 @@ <h2>Subdued</h2>
100100
<section>
101101
<h2>Checked</h2>
102102
<code>input:checked + hx-tile</code>
103-
<div class="hxRow choice-tile-demo">
103+
<div class="hxRow choice-tile-spec">
104104
<!-- input:checked -->
105105
<label class="hxChoice">
106106
<input type="radio" name="checked1" checked />
@@ -146,7 +146,7 @@ <h2>Checked</h2>
146146
<h2>Checked + Subdued</h2>
147147
<code>input:checked + hx-tile.hxSubdued</code>
148148
<p>Checked should override Subdued</p>
149-
<div class="hxRow choice-tile-demo">
149+
<div class="hxRow choice-tile-spec">
150150
<!-- input:checked + .hxSubdued -->
151151
<label class="hxChoice">
152152
<input type="radio" name="checkSub1" checked />
@@ -191,7 +191,7 @@ <h2>Checked + Subdued</h2>
191191
<section>
192192
<h2>Invalid</h2>
193193
<code>input[invalid] + hx-tile</code>
194-
<div class="hxRow choice-tile-demo">
194+
<div class="hxRow choice-tile-spec">
195195
<!-- input[invalid] -->
196196
<label class="hxChoice">
197197
<input type="radio" name="invalid1" invalid />
@@ -237,7 +237,7 @@ <h2>Invalid</h2>
237237
<h2>Invalid + Subdued</h2>
238238
<code>input[invalid] + hx-tile.hxSubdued</code>
239239
<p>Invalid should override Subdued</p>
240-
<div class="hxRow choice-tile-demo">
240+
<div class="hxRow choice-tile-spec">
241241
<!-- input[invalid] + .hxSubdued -->
242242
<label class="hxChoice">
243243
<input type="radio" name="invalidSub1" invalid />
@@ -281,7 +281,7 @@ <h2>Invalid + Subdued</h2>
281281

282282
<section>
283283
<h2>Disabled</h2>
284-
<div class="hxRow choice-tile-demo">
284+
<div class="hxRow choice-tile-spec">
285285
<!-- input[disabled] -->
286286
<label class="hxChoice">
287287
<input type="radio" name="disabled1" disabled />
@@ -314,7 +314,7 @@ <h2>Disabled</h2>
314314
<h2>Invalid + Checked</h2>
315315
<code>input[invalid]:checked + hx-tile</code>
316316
<p>Invalid should override Checked</p>
317-
<div class="hxRow choice-tile-demo">
317+
<div class="hxRow choice-tile-spec">
318318
<!-- input[invalid]:checked -->
319319
<label class="hxChoice">
320320
<input type="radio" name="invalidCheck1" invalid checked />
@@ -360,7 +360,7 @@ <h2>Invalid + Checked</h2>
360360
<h2>Invalid + Checked + Subdued</h2>
361361
<code>input[invalid]:checked + hx-tile</code>
362362
<p>Invalid should override Checked and Subdued</p>
363-
<div class="hxRow choice-tile-demo">
363+
<div class="hxRow choice-tile-spec">
364364
<!-- input[invalid]:checked + .hxSubdued -->
365365
<label class="hxChoice">
366366
<input type="radio" name="invChkSub1" invalid checked />
@@ -406,7 +406,7 @@ <h2>Invalid + Checked + Subdued</h2>
406406
<h2>Disabled + Checked</h2>
407407
<code>input[disabled] + hx-tile</code>
408408
<p>Disabled should override Checked</p>
409-
<div class="hxRow choice-tile-demo">
409+
<div class="hxRow choice-tile-spec">
410410
<!-- input[disabled]:checked -->
411411
<label class="hxChoice">
412412
<input type="radio" name="disChk1" disabled checked />
@@ -439,7 +439,7 @@ <h2>Disabled + Checked</h2>
439439
<h2>Disabled + Invalid</h2>
440440
<code>input[disabled][invalid] + hx-tile</code>
441441
<p>Disabled should override Invalid</p>
442-
<div class="hxRow choice-tile-demo">
442+
<div class="hxRow choice-tile-spec">
443443
<!-- input[disabled][invalid] -->
444444
<label class="hxChoice">
445445
<input type="radio" name="invDis1" disabled invalid />
@@ -472,7 +472,7 @@ <h2>Disabled + Invalid</h2>
472472
<h2>Disabled + Invalid + Checked</h2>
473473
<code>input[disabled][invalid]:checked + hx-tile</code>
474474
<p>Disabled should override Invalid and Checked</p>
475-
<div class="hxRow choice-tile-demo">
475+
<div class="hxRow choice-tile-spec">
476476
<!-- input[disabled][invalid]:checked -->
477477
<label class="hxChoice">
478478
<input type="radio" name="invChkDis1" disabled invalid checked />

docs/components/popover/test.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
label: Popover
66
---
77
{% extends 'test.njk' %}
8+
{% set contentClasses = 'popover-spec' %}
89

910
{% block content %}
1011
{# TODO: Write tests to set shadow position on open and render. #}
@@ -264,7 +265,7 @@ <h2>HTML5-compatible ID</h2>
264265
</hx-popover>
265266
</section>
266267

267-
<section id="popover-in-scrolling-container" class="test">
268+
<section id="popover-in-scrolling-container">
268269
<h2>Within Scrollable Container</h2>
269270
<ul class="hxList">
270271
<li>TODO: Should we hide the popover when its relative element isn't visible (scrolls out of view)?</li>

docs/docs.less

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,20 +425,20 @@ min-version {
425425

426426
// Import from docs/styles/*
427427
@import 'demo/box-docs';
428-
@import 'demo/button-docs';
429-
@import 'demo/choice-tiles-docs';
430428
@import 'demo/grid-docs';
431429
@import 'demo/icon-docs';
432430
@import 'demo/nav-docs';
433431
@import 'demo/panel-docs';
434-
@import 'demo/popover-docs';
435432
@import 'demo/tabset-docs';
436433
@import 'demo/tooltip-docs';
437434
@import 'demo/typography-docs';
438435
// Spec Styles
436+
@import 'spec/button-spec';
439437
@import 'spec/checkbox-spec';
438+
@import 'spec/choice-tile-spec';
440439
@import 'spec/dropdown-select-spec';
441440
@import 'spec/panel-spec';
441+
@import 'spec/popover-spec';
442442
@import 'spec/radio-spec';
443443
@import 'spec/text-input-spec';
444444
@import 'spec/textarea-spec';

docs/styles/demo/button-docs.less

Lines changed: 0 additions & 41 deletions
This file was deleted.

docs/styles/demo/popover-docs.less

Lines changed: 0 additions & 26 deletions
This file was deleted.

docs/styles/spec/button-spec.less

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
@import (reference) 'components/buttons';
2+
3+
.button-spec {
4+
.hxBtn {
5+
&[class*="pseudo"] {
6+
pointer-events: none;
7+
}
8+
9+
&.pseudo-hover:extend(.hxBtn:hover) {}
10+
&.pseudo-active:extend(.hxBtn:active) {}
11+
&.pseudo-focus:extend(.hxBtn:focus) {}
12+
13+
&.hxPrimary {
14+
&.pseudo-hover:extend(.hxBtn.hxPrimary:hover) {}
15+
&.pseudo-active:extend(.hxBtn.hxPrimary:active) {}
16+
&.pseudo-focus:extend(.hxBtn.hxPrimary:focus) {}
17+
}
18+
19+
&.hxTertiary {
20+
&.pseudo-hover:extend(.hxBtn.hxTertiary:hover) {}
21+
&.pseudo-active:extend(.hxBtn.hxTertiary:active) {}
22+
&.pseudo-focus:extend(.hxBtn.hxTertiary:focus) {}
23+
}
24+
25+
a[href]& {
26+
&.pseudo-hover:extend(a[href].hxBtn:hover) {}
27+
&.pseudo-active:extend(a[href].hxBtn:active) {}
28+
&.pseudo-focus::extend(a[href].hxBtn:focus) {}
29+
30+
&.hxPrimary {
31+
&.pseudo-hover:extend(a[href].hxBtn.hxPrimary:hover) {}
32+
&.pseudo-active:extend(a[href].hxBtn.hxPrimary:active) {}
33+
&.pseudo-focus:extend(a[href].hxBtn.hxPrimary:focus) {}
34+
}
35+
36+
&.hxTertiary {
37+
&.pseudo-hover:extend(a[href].hxBtn.hxTertiary:hover) {}
38+
&.pseudo-active:extend(a[href].hxBtn.hxTertiary:active) {}
39+
&.pseudo-focus:extend(a[href].hxBtn.hxTertiary:focus) {}
40+
}
41+
}
42+
}
43+
}

docs/styles/demo/choice-tiles-docs.less renamed to docs/styles/spec/choice-tile-spec.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@import (reference) 'components/choice-tiles';
22

3-
.choice-tile-demo {
3+
.choice-tile-spec {
44
label.hxChoice > input {
55
/* Default (focus, hover) */
66
&.pseudo-focus + hx-tile {

docs/styles/spec/popover-spec.less

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.popover-spec {
2+
#popover-in-scrolling-container {
3+
hx-div[scroll="vertical"] {
4+
border: 1px solid;
5+
height: 15rem; // 240px
6+
width: 30rem; // 480px
7+
}
8+
}
9+
10+
.popover-appearance {
11+
display: flex;
12+
flex-wrap: wrap;
13+
z-index: 0;
14+
15+
hx-popover {
16+
display: block;
17+
margin: 20px;
18+
position: relative;
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)