Added title attribute (#1043)

* added title attribute

Fixes #1042

* added tests for title

* also some other tests

* clarify why title was added
This commit is contained in:
Bünyamin Eskiocak
2022-11-30 23:42:56 +03:00
committed by GitHub
parent 31e1f2fc59
commit 35aa56d334
12 changed files with 135 additions and 16 deletions

View File

@@ -23,6 +23,7 @@ describe('<sl-button>', () => {
it('default values are set correctly', async () => {
const el = await fixture<SlButton>(html` <sl-button>Button Label</sl-button> `);
expect(el.title).to.equal('');
expect(el.variant).to.equal('default');
expect(el.size).to.equal('medium');
expect(el.disabled).to.equal(false);
@@ -88,6 +89,13 @@ describe('<sl-button>', () => {
});
});
it('should have title if title attribute isset', async () => {
const el = await fixture<SlButton>(html` <sl-button title="Test"></sl-button> `);
const button = el.shadowRoot!.querySelector<HTMLButtonElement>('[part~="base"]')!;
expect(button.title).to.equal('Test');
});
describe('when loading', () => {
it('should have a spinner present', async () => {
const el = await fixture<SlButton>(html` <sl-button loading>Button Label</sl-button> `);