Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions elements/pfe-content-set/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ Each header must have an attribute of `pfe-content-set--header` and each panel m
- `vertical`
- Accordion: No effect.
- Tabs: Headings stack on the left, content pane is shown on the right.
- `pfe-align="center"`
- Accordion: No effect.
- Tabs: Tabs are centered.



Expand Down
18 changes: 18 additions & 0 deletions elements/pfe-content-set/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,24 @@ <h2 pfe-content-set--header>Heading 2</h2>
<div pfe-content-set--panel>Content for heading 2. Sed posuere consectetur est at lobortis. Donec id elit non mi porta gravida at eget metus. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Maecenas faucibus mollis interdum.</div>
</pfe-content-set>

<hr>

<h2>Align: center</h2>
<pfe-content-set pfe-align="center">
<h2 pfe-content-set--header>Heading 1</h2>
<div pfe-content-set--panel>
<p>Content for heading 1. Maecenas faucibus mollis interdum. Maecenas sed diam eget risus varius blandit sit amet non magna. Maecenas sed diam eget risus varius blandit sit amet non magna. Maecenas sed diam eget risus varius blandit sit amet non magna. Etiam porta sem malesuada magna mollis euismod.</p>
<div class="cta">
<a href="https://redhat.com">Primary CTA</a>
</div>
</div>
<h2 pfe-content-set--header>Heading 2</h2>
<div pfe-content-set--panel>Content for heading 2. Sed posuere consectetur est at lobortis. Donec id elit non mi porta gravida at eget metus. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Maecenas faucibus mollis interdum.</div>
<h2 pfe-content-set--header>Heading 3</h2>
<div pfe-content-set--panel>Content for heading 3. Donec ullamcorper nulla non metus auctor fringilla. Donec ullamcorper nulla non metus auctor fringilla. Vestibulum id ligula porta felis euismod semper. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Cras mattis consectetur purus sit amet fermentum.</div>
</pfe-content-set>

<hr>
<h2>This content set's markup is incorrect.</h2>
<pfe-content-set>
<h2>Heading 1</h2>
Expand Down
4 changes: 4 additions & 0 deletions elements/pfe-content-set/src/pfe-content-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ class PfeContentSet extends PFElement {
tabs.setAttribute("on", this.on.value);
}

if (this.align.value) {
tabs.setAttribute("pfe-tab-align", this.align.value);
}

if (!existingTabs) {
this.appendChild(fragment);
}
Expand Down
6 changes: 6 additions & 0 deletions elements/pfe-content-set/src/pfe-content-set.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@
"default": "wind",
"prefixed": true
},
"align": {
"title": "Align",
"type": "string",
"enum": ["center"],
"prefixed": true
},
"on": {
"title": "Context",
"type": "string",
Expand Down
14 changes: 14 additions & 0 deletions elements/pfe-content-set/test/pfe-content-set_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ <h2 pfe-content-set--header>Heading 1</h2>
</pfe-content-set>
</div>

<pfe-content-set id="align" pfe-align="center">
<h2 pfe-content-set--header>Heading 1</h2>
<p pfe-content-set--panel>Panel 1</p>
</pfe-content-set>

<script>
suite('<pfe-content-set>', () => {
test('it should have the proper attributes for tabs', () => {
Expand Down Expand Up @@ -163,6 +168,15 @@ <h2 pfe-content-set--header>Heading 1</h2>
done();
});
});

test("it should set pfe-tab-align on the tabs if the pfe-align attribute is present on pfe-content-set", () => {
const pfeContentSet = document.querySelector("#align");
const pfeTabs = pfeContentSet.querySelector("pfe-tabs");
const alignValue = pfeContentSet.getAttribute("pfe-align");
const pfeTabAlignValue = pfeTabs.getAttribute("pfe-tab-align");

assert.equal(alignValue, pfeTabAlignValue);
});
});
</script>
</body>
Expand Down