Skip to content

Commit f392a0f

Browse files
authored
fix: slots containing dashes in JS file (#768)
1 parent 96f0a1b commit f392a0f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CHANGELOG-prerelease.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
- [27fee5f](https://github.com/patternfly/patternfly-elements/commit/27fee5f5c5eb021ac126f3767dd0299f5cda8231) fix: pfe-tabs check for tagName on addedNode mutation before continuing
44
- [2c950b0](https://github.com/patternfly/patternfly-elements/commit/2c950b08f7638787df50aa5ee6738f1205ea3a9d) fix: Add clearfix within tab and accordion panels
5-
- [](https://github.com/patternfly/patternfly-elements/commit/) feat: Add border to the card component
5+
- [96f0a1b](https://github.com/patternfly/patternfly-elements/commit/96f0a1bdf9c758650e02b20a63ee3fb2fcf11bc9) feat: Add border to the card component
6+
- [](https://github.com/patternfly/patternfly-elements/commit/) fix: Generator needs to convert slot-name to camelCase in js file if dash exists
67

78
## Prerelese 45 ( 2020-04-27 )
89

generators/element/templates/src/element.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class <%= elementClassName %> extends PFElement {
4040
super(<%= elementClassName %>, { type: <%= elementClassName %>.PfeType });
4141
<%_ if (slots.length > 0) { %>
4242
<%_ for(let i = 0; i < slots.length; i++) { _%>
43-
this._<%= slots[i] %> = this.shadowRoot.querySelector(`.${this.tag}__<%= slots[i] %>`);
43+
this._<%= _.camelCase(slots[i]) %> = this.shadowRoot.querySelector(`.${this.tag}__<%= slots[i] %>`);
4444
<%_ } } _%>
4545
}
4646

@@ -49,11 +49,11 @@ class <%= elementClassName %> extends PFElement {
4949
// If you need to initialize any attributes, do that here
5050
<%_ if (slots.length > 0) { %>
5151
<%_ for(let i = 0; i < slots.length; i++) { _%>
52-
this.<%= slots[i] %> = this.querySelector(`[slot="${this.tag}--<%= slots[i] %>"]`);
52+
this.<%= _.camelCase(slots[i]) %> = this.querySelector(`[slot="${this.tag}--<%= slots[i] %>"]`);
5353
<%_ } _%>
5454
<%_ for(let i = 0; i < slots.length; i++) { %>
5555
// Add a slotchange listener to the lightDOM trigger
56-
// this.<%= slots[i] %>.addEventListener("slotchange", this._init);
56+
// this.<%= _.camelCase(slots[i]) %>.addEventListener("slotchange", this._init);
5757
<%_ } _%>
5858
<%_ } _%>
5959

0 commit comments

Comments
 (0)