diff --git a/src/components/button/button.test.ts b/src/components/button/button.test.ts index 31daf8fc..dff552d1 100644 --- a/src/components/button/button.test.ts +++ b/src/components/button/button.test.ts @@ -23,6 +23,7 @@ describe('', () => { it('default values are set correctly', async () => { const el = await fixture(html` Button Label `); + 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('', () => { }); }); + it('should have title if title attribute isset', async () => { + const el = await fixture(html` `); + const button = el.shadowRoot!.querySelector('[part~="base"]')!; + + expect(button.title).to.equal('Test'); + }); + describe('when loading', () => { it('should have a spinner present', async () => { const el = await fixture(html` Button Label `); diff --git a/src/components/button/button.ts b/src/components/button/button.ts index a62d375b..065d963e 100644 --- a/src/components/button/button.ts +++ b/src/components/button/button.ts @@ -98,6 +98,8 @@ export default class SlButton extends ShoelaceElement implements ShoelaceFormCon /** An optional value for the button. Ignored when `href` is set. */ @property() value = ''; + @property() title = ''; // make reactive to pass through + /** When set, the underlying button will be rendered as an `` with this `href` instead of a `