Skip to content

Commit

Permalink
fix(modal): cleanup and update snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
ariellalgilmore committed Dec 14, 2023
1 parent ad605e3 commit 735d850
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CDSModalCloseButton extends FocusMixin(LitElement) {
closeButtonLabel = 'Close';

updated() {
this.parentElement.setAttribute('close-button', '');
this.parentElement?.setAttribute('close-button', '');
}

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class CDSModalFooter extends LitElement {
).length;
this.hasThreeButtons = length > 2;
length === 2
? this.parentElement.setAttribute('has-two-buttons', '')
: this.parentElement.removeAttribute('has-two-buttons');
? this.parentElement?.setAttribute('has-two-buttons', '')
: this.parentElement?.removeAttribute('has-two-buttons');
this.requestUpdate();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ class CDSModalHeader extends LitElement {

updated() {
if (this._hasSlug) {
this.parentElement.setAttribute('slug', '');
this.parentElement?.setAttribute('slug', '');
} else {
this.parentElement!.removeAttribute('slug');
this.parentElement?.removeAttribute('slug');
}
}

Expand Down
22 changes: 13 additions & 9 deletions packages/carbon-web-components/tests/snapshots/cds-checkbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

```
<input
aria-checked="false"
aria-checked="true"
aria-readonly="false"
class="cds--checkbox"
id="checkbox"
Expand All @@ -20,19 +20,21 @@
title=""
>
<span class="cds--checkbox-label-text">
<slot>
Checkbox label
</slot>
Checkbox label
</span>
</label>
<slot name="slug">
</slot>
<div class="cds--checkbox__validation-msg">
</div>
```

#### `Should render with various attributes`

```
<input
aria-checked="mixed"
aria-checked="true"
aria-readonly="false"
class="cds--checkbox"
disabled=""
Expand All @@ -46,12 +48,14 @@
part="label"
title=""
>
<span class="cds--checkbox-label-text cds--visually-hidden">
<slot>
label-text-foo
</slot>
<span class="cds--checkbox-label-text">
Checkbox label
</span>
</label>
<slot name="slug">
</slot>
<div class="cds--checkbox__validation-msg">
</div>
```

0 comments on commit 735d850

Please sign in to comment.