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

@@ -18,6 +18,7 @@ describe('<sl-input>', () => {
expect(el.name).to.equal('');
expect(el.value).to.equal('');
expect(el.defaultValue).to.equal('');
expect(el.title).to.equal('');
expect(el.filled).to.be.false;
expect(el.pill).to.be.false;
expect(el.label).to.equal('');
@@ -47,6 +48,13 @@ describe('<sl-input>', () => {
expect(isNaN(el.valueAsNumber)).to.be.true;
});
it('should have title if title attribute isset', async () => {
const el = await fixture<SlInput>(html` <sl-input title="Test"></sl-input> `);
const input = el.shadowRoot!.querySelector<HTMLInputElement>('[part~="input"]')!;
expect(input.title).to.equal('Test');
});
it('should be disabled with the disabled attribute', async () => {
const el = await fixture<SlInput>(html` <sl-input disabled></sl-input> `);
const input = el.shadowRoot!.querySelector<HTMLInputElement>('[part~="input"]')!;