Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove 'variant' attribute from coach indicator #4772

Draft
wants to merge 1 commit into
base: ruben/remove-deprecations
Choose a base branch
from
Draft
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
12 changes: 6 additions & 6 deletions packages/coachmark/coach-indicator.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ When looking to leverage the `CoachIndicator` base class as a type and/or for ex
import { CoachIndicator } from '@spectrum-web-components/coachmark';
```

## Variants
## Static variants

<sp-tabs selected="standard" auto label="Variant Options">
<sp-tabs selected="standard" auto label="Static Options">
<sp-tab value="standard">Standard</sp-tab>
<sp-tab-panel value="standard">

```html
<sp-coach-indicator></sp-coach-indicator>
<sp-coach-indicator variant="dark"></sp-coach-indicator>
<sp-coach-indicator variant="light"></sp-coach-indicator>
<sp-coach-indicator static="dark"></sp-coach-indicator>
<sp-coach-indicator static="light"></sp-coach-indicator>
```

</sp-tab-panel>
Expand All @@ -41,8 +41,8 @@ import { CoachIndicator } from '@spectrum-web-components/coachmark';

```html
<sp-coach-indicator quiet></sp-coach-indicator>
<sp-coach-indicator quiet variant="dark"></sp-coach-indicator>
<sp-coach-indicator quiet variant="light"></sp-coach-indicator>
<sp-coach-indicator quiet static="dark"></sp-coach-indicator>
<sp-coach-indicator quiet static="light"></sp-coach-indicator>
```

</sp-tab-panel>
Expand Down
22 changes: 0 additions & 22 deletions packages/coachmark/src/CoachIndicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ governing permissions and limitations under the License.
import {
CSSResultArray,
html,
PropertyValues,
SpectrumElement,
TemplateResult,
} from '@spectrum-web-components/base';
Expand All @@ -33,32 +32,11 @@ export class CoachIndicator extends SpectrumElement {
@property({ reflect: true })
public static?: 'white' | 'black';

@property({ reflect: true })
public variant?: 'white' | 'black';

protected override render(): TemplateResult {
return html`
<div class="ring"></div>
<div class="ring"></div>
<div class="ring"></div>
`;
}

protected override updated(changes: PropertyValues): void {
super.updated(changes);
if (
changes.has('variant') &&
(this.variant || typeof changes.get('variant'))
) {
this.static = this.variant;
if (window.__swc.DEBUG) {
window.__swc.warn(
this,
`The "variant" attribute/property of <${this.localName}> have been deprecated. Use "static" with any of the same values instead. "variant" will be removed in a future release.`,
'https://opensource.adobe.com/spectrum-web-components/components/badge/#fixed',
{ level: 'deprecation' }
);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ export default {

export const staticWhite = (): TemplateResult => {
return html`
<sp-coach-indicator variant="white"></sp-coach-indicator>
<sp-coach-indicator quiet variant="white"></sp-coach-indicator>
<sp-coach-indicator static="white"></sp-coach-indicator>
<sp-coach-indicator quiet static="white"></sp-coach-indicator>
`;
};

export const staticBlack = (): TemplateResult => {
return html`
<sp-coach-indicator variant="black"></sp-coach-indicator>
<sp-coach-indicator quiet variant="black"></sp-coach-indicator>
<sp-coach-indicator static="black"></sp-coach-indicator>
<sp-coach-indicator quiet static="black"></sp-coach-indicator>
`;
};
25 changes: 6 additions & 19 deletions packages/coachmark/test/coach-indicator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,15 @@ import { testForLitDevWarnings } from '../../../test/testing-helpers.js';
describe('CoachIndicator', () => {
testForLitDevWarnings(
async () =>
await fixture<CoachIndicator>(
html`
<sp-coach-indicator></sp-coach-indicator>
`
)
await fixture<CoachIndicator>(html`
<sp-coach-indicator></sp-coach-indicator>
`)
);
it('loads default coach-indicator accessibly', async () => {
const el = await fixture<CoachIndicator>(
html`
<sp-coach-indicator></sp-coach-indicator>
`
);
const el = await fixture<CoachIndicator>(html`
<sp-coach-indicator></sp-coach-indicator>
`);
await elementUpdated(el);
await expect(el).to.be.accessible();
});
it('loads coach-indicator white static variant', async () => {
const el = await fixture<CoachIndicator>(
html`
<sp-coach-indicator variant="white"></sp-coach-indicator>
`
);
await elementUpdated(el);
expect(el.static == 'white').to.be.true;
});
});