Skip to content

Commit

Permalink
honour akn--no-border on tables
Browse files Browse the repository at this point in the history
closes #274
  • Loading branch information
longhotsummer committed Jul 4, 2024
1 parent e7bc599 commit d77acc2
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 18 deletions.
7 changes: 7 additions & 0 deletions law-widget-styles/css/law-widget-styles.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions law-widget-styles/scss/mixins/_tables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
border: $akn-table-border-width solid $akn-table-border-colour;
border-collapse: collapse;

// hide borders for .akn--no-border
&.akn--no-border {
border-width: 0px;

th,
td {
border-width: 0px;
}
}

// Cells
th,
td {
Expand Down
60 changes: 50 additions & 10 deletions law-widget-styles/tests/tables.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,55 @@

<div class="akoma-ntoso">

<span class="akn-akomaNtoso"><article class="akn-act" data-contains="originalVersion" data-name="act"><span class="akn-body"><span class="akn-hcontainer" id="hcontainer_1" data-eId="hcontainer_1" data-name="hcontainer"><span class="akn-content"><div class="akn--table-container"><table eId="hcontainer_1__table_1">
<tr>
<th><span class="akn-p">heading 1</span></th>
<th><span class="akn-p">heading 2</span></th>
</tr>
<tr>
<td><span class="akn-p">cell 1</span></td>
<td><span class="akn-p">cell 2</span></td>
</tr>
</table></div></span></span></span></article></span>
<span class="akn-akomaNtoso">
<span class="akn-act" data-name="act">

<span class="akn-body">
<section class="akn-section" id="sec_1" data-eId="sec_1"><h3>1 Plain</h3>
<span class="akn-content">
<div class="akn--table-container"><table class="akn-table" id="sec_1__table_1" data-eId="sec_1__table_1">
<tr class="akn-tr">
<th class="akn-th">
<span class="akn-p" id="sec_1__table_1__p_1" data-eId="sec_1__table_1__p_1">heading 1</span>
</th>
<th class="akn-th">
<span class="akn-p" id="sec_1__table_1__p_2" data-eId="sec_1__table_1__p_2">heading 2</span>
</th>
</tr>
<tr class="akn-tr">
<td class="akn-td">
<span class="akn-p" id="sec_1__table_1__p_3" data-eId="sec_1__table_1__p_3">cell 1</span>
</td>
<td class="akn-td">
<span class="akn-p" id="sec_1__table_1__p_4" data-eId="sec_1__table_1__p_4">cell 2</span>
</td>
</tr>
</table></div>
</span></section>
<section class="akn-section" id="sec_2" data-eId="sec_2"><h3>2 No heading</h3>
<span class="akn-content">
<div class="akn--table-container"><table class="akn-table akn--no-border" id="sec_2__table_1" data-eId="sec_2__table_1">
<tr class="akn-tr">
<th class="akn-th">
<span class="akn-p" id="sec_2__table_1__p_1" data-eId="sec_2__table_1__p_1">heading 1</span>
</th>
<th class="akn-th">
<span class="akn-p" id="sec_2__table_1__p_2" data-eId="sec_2__table_1__p_2">heading 2</span>
</th>
</tr>
<tr class="akn-tr">
<td class="akn-td">
<span class="akn-p" id="sec_2__table_1__p_3" data-eId="sec_2__table_1__p_3">cell 1</span>
</td>
<td class="akn-td">
<span class="akn-p" id="sec_2__table_1__p_4" data-eId="sec_2__table_1__p_4">cell 2</span>
</td>
</tr>
</table></div>
</span></section>
</span>
</span>
</span>

</body>
</html>
36 changes: 29 additions & 7 deletions law-widget-styles/tests/tables.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
BODY

{|
! heading 1
! heading 2
|-
| cell 1
| cell 2
|}
SEC 1 - Plain

TABLE
TR
TH
heading 1
TH
heading 2

TR
TC
cell 1
TC
cell 2

SEC 2 - No heading

TABLE.akn--no-border
TR
TH
heading 1
TH
heading 2

TR
TC
cell 1
TC
cell 2
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion law-widget-styles/tests/visual.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ expect.extend({ toMatchImageSnapshot });

const config = {
comparisonMethod: 'pixelmatch',
failureThreshold: 1.0,
failureThreshold: 0.0,
failureThresholdType: 'percent',
};

Expand Down

0 comments on commit d77acc2

Please sign in to comment.