Skip to content

Commit

Permalink
labelText -> plainText
Browse files Browse the repository at this point in the history
  • Loading branch information
bearfriend committed Jun 27, 2023
1 parent 5954ebb commit 30f00f1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions components/tag-list/tag-list-item-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
this.keyboardTooltipItem = false;
this.keyboardTooltipShown = false;
this._id = getUniqueId();
this._labelText = '';
this._plainText = '';
}

firstUpdated(changedProperties) {
Expand Down Expand Up @@ -172,7 +172,7 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
_handleClearItem() {
if (!this.clearable) return;

announce(this.localize('components.tag-list.cleared-item', { value: this._labelText }));
announce(this.localize('components.tag-list.cleared-item', { value: this._plainText }));

/** Dispatched when a user selects to delete an individual tag list item. The consumer must handle the actual element deletion and focus behaviour if there are no remaining list items. */
this.dispatchEvent(new CustomEvent(
Expand Down Expand Up @@ -216,10 +216,10 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
}

_renderTag(tagContent, options = {}) {
if (options.labelText?.constructor !== String) throw new TypeError('options.labelText must be a string');
this._labelText = options.labelText || '';
if (options.plainText?.constructor !== String) throw new TypeError('options.plainText must be a string');
this._plainText = options.plainText || '';

const buttonText = this.localize('components.tag-list.clear', { value: this._labelText });
const buttonText = this.localize('components.tag-list.clear', { value: this._plainText });

const hasDescription = !!options.description;

Expand Down
2 changes: 1 addition & 1 deletion components/tag-list/tag-list-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TagListItem extends TagListItemMixin(LitElement) {
return this._renderTag(this.text, {
description: this.description,
hasTruncationTooltip: true,
labelText: this.text
plainText: this.text
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/tag-list/test/tag-list-item-mixin-consumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class TagListItemMixinConsumer extends TagListItemMixin(LitElement) {

return html`
<d2l-dropdown open-on-hover>
${this._renderTag(tagContent, { focusableClass: 'd2l-dropdown-opener', labelText: this.name })}
${this._renderTag(tagContent, { focusableClass: 'd2l-dropdown-opener', plainText: this.name })}
<d2l-dropdown-content no-auto-focus>Custom</d2l-dropdown-content>
</d2l-dropdown>
`;
Expand Down
4 changes: 2 additions & 2 deletions components/tag-list/test/tag-list.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe('d2l-tag-list-item', () => {
await waitUntil(() => elem._items, 'List items did not become ready');

const child = elem.children[1];
expect(child._labelText).to.be.equal('Another Tag');
expect(child._plainText).to.be.equal('Another Tag');
});
});

Expand Down Expand Up @@ -164,7 +164,7 @@ describe('d2l-tag-list-item-mixin-consumer', () => {
await waitUntil(() => elem._items, 'List items did not become ready');

const child = elem.children[3];
expect(child._labelText).to.be.equal('Tag');
expect(child._plainText).to.be.equal('Tag');
});

it('should error if not provided', async() => {
Expand Down

0 comments on commit 30f00f1

Please sign in to comment.