Skip to content

Commit ba11919

Browse files
authored
Merge pull request #88 from open-wc/westbrook/not-title
Do not use "title" as an attribute/property of an element
2 parents 08af9aa + ecb150e commit ba11919

File tree

10 files changed

+39
-39
lines changed

10 files changed

+39
-39
lines changed

src/generators/app-lit-element-ts/templates/my-app.stories.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ interface Story<T> {
1616
}
1717

1818
interface ArgTypes {
19-
title?: string;
19+
header?: string;
2020
backgroundColor?: string;
2121
}
2222

23-
const Template: Story<ArgTypes> = ({ title, backgroundColor = 'white' }: ArgTypes) => html`
24-
<<%= tagName %> style="--<%= tagName %>-background-color: ${backgroundColor}" .title=${title}></<%= tagName %>>
23+
const Template: Story<ArgTypes> = ({ header, backgroundColor = 'white' }: ArgTypes) => html`
24+
<<%= tagName %> style="--<%= tagName %>-background-color: ${backgroundColor}" .header=${header}></<%= tagName %>>
2525
`;
2626

2727
export const App = Template.bind({});
2828
App.args = {
29-
title: 'My app',
29+
header: 'My app',
3030
};

src/generators/app-lit-element/templates/my-app.stories.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ export default {
99
},
1010
};
1111

12-
function Template({ title, backgroundColor }) {
12+
function Template({ header, backgroundColor }) {
1313
return html`
1414
<<%= tagName %>
1515
style="--<%= tagName %>-background-color: ${backgroundColor || 'white'}"
16-
.title=${title}
16+
.header=${header}
1717
>
1818
</<%= tagName %>>
1919
`;
2020
}
2121

2222
export const App = Template.bind({});
2323
App.args = {
24-
title: 'My app',
24+
header: 'My app',
2525
};

src/generators/demoing-storybook-ts/templates/static-scaffold/stories/index.stories.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
title: '<%= className %>',
66
component: '<%= tagName %>',
77
argTypes: {
8-
title: { control: 'text' },
8+
header: { control: 'text' },
99
counter: { control: 'number' },
1010
textColor: { control: 'color' },
1111
},
@@ -18,21 +18,21 @@ interface Story<T> {
1818
}
1919

2020
interface ArgTypes {
21-
title?: string;
21+
header?: string;
2222
counter?: number;
2323
textColor?: string;
2424
slot?: TemplateResult;
2525
}
2626

2727
const Template: Story<ArgTypes> = ({
28-
title = 'Hello world',
28+
header = 'Hello world',
2929
counter = 5,
3030
textColor,
3131
slot,
3232
}: ArgTypes) => html`
3333
<<%= tagName %>
3434
style="--<%= tagName %>-text-color: ${textColor || 'black'}"
35-
.title=${title}
35+
.header=${header}
3636
.counter=${counter}
3737
>
3838
${slot}
@@ -41,9 +41,9 @@ const Template: Story<ArgTypes> = ({
4141

4242
export const Regular = Template.bind({});
4343

44-
export const CustomTitle = Template.bind({});
45-
CustomTitle.args = {
46-
title: 'My title',
44+
export const CustomHeader = Template.bind({});
45+
CustomHeader.args = {
46+
header: 'My header',
4747
};
4848

4949
export const CustomCounter = Template.bind({});

src/generators/demoing-storybook/templates/static-scaffold/stories/index.stories.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ export default {
55
title: '<%= className %>',
66
component: '<%= tagName %>',
77
argTypes: {
8-
title: { control: 'text' },
8+
header: { control: 'text' },
99
counter: { control: 'number' },
1010
textColor: { control: 'color' },
1111
},
1212
};
1313

14-
function Template({ title = 'Hello world', counter = 5, textColor, slot }) {
14+
function Template({ header = 'Hello world', counter = 5, textColor, slot }) {
1515
return html`
1616
<<%= tagName %>
1717
style="--<%= tagName %>-text-color: ${textColor || 'black'}"
18-
.title=${title}
18+
.header=${header}
1919
.counter=${counter}
2020
>
2121
${slot}
@@ -25,9 +25,9 @@ function Template({ title = 'Hello world', counter = 5, textColor, slot }) {
2525

2626
export const Regular = Template.bind({});
2727

28-
export const CustomTitle = Template.bind({});
29-
CustomTitle.args = {
30-
title: 'My title',
28+
export const CustomHeader = Template.bind({});
29+
CustomHeader.args = {
30+
header: 'My header',
3131
};
3232

3333
export const CustomCounter = Template.bind({});

src/generators/testing-ts/templates/my-el.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { <%= className %> } from '../src/<%= className %>.js';
44
import '../src/<%= tagName %>.js';
55

66
describe('<%= className %>', () => {
7-
it('has a default title "Hey there" and counter 5', async () => {
7+
it('has a default header "Hey there" and counter 5', async () => {
88
const el = await fixture<<%= className %>>(html`<<%= tagName %>></<%= tagName %>>`);
99

10-
expect(el.title).to.equal('Hey there');
10+
expect(el.header).to.equal('Hey there');
1111
expect(el.counter).to.equal(5);
1212
});
1313

@@ -18,10 +18,10 @@ describe('<%= className %>', () => {
1818
expect(el.counter).to.equal(6);
1919
});
2020

21-
it('can override the title via attribute', async () => {
22-
const el = await fixture<<%= className %>>(html`<<%= tagName %> title="attribute title"></<%= tagName %>>`);
21+
it('can override the header via attribute', async () => {
22+
const el = await fixture<<%= className %>>(html`<<%= tagName %> header="attribute header"></<%= tagName %>>`);
2323

24-
expect(el.title).to.equal('attribute title');
24+
expect(el.header).to.equal('attribute header');
2525
});
2626

2727
it('passes the a11y audit', async () => {

src/generators/testing/templates/my-el.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { fixture, expect } from '@open-wc/testing';
44
import '../<%= tagName %>.js';
55

66
describe('<%= className %>', () => {
7-
it('has a default title "Hey there" and counter 5', async () => {
7+
it('has a default header "Hey there" and counter 5', async () => {
88
const el = await fixture(html`<<%= tagName %>></<%= tagName %>>`);
99

10-
expect(el.title).to.equal('Hey there');
10+
expect(el.header).to.equal('Hey there');
1111
expect(el.counter).to.equal(5);
1212
});
1313

@@ -18,10 +18,10 @@ describe('<%= className %>', () => {
1818
expect(el.counter).to.equal(6);
1919
});
2020

21-
it('can override the title via attribute', async () => {
22-
const el = await fixture(html`<<%= tagName %> title="attribute title"></<%= tagName %>>`);
21+
it('can override the header via attribute', async () => {
22+
const el = await fixture(html`<<%= tagName %> header="attribute header"></<%= tagName %>>`);
2323

24-
expect(el.title).to.equal('attribute title');
24+
expect(el.header).to.equal('attribute header');
2525
});
2626

2727
it('passes the a11y audit', async () => {

src/generators/wc-lit-element-ts/templates/MyEl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class <%= className %> extends LitElement {
1010
}
1111
`;
1212

13-
@property({ type: String }) title = 'Hey there';
13+
@property({ type: String }) header = 'Hey there';
1414

1515
@property({ type: Number }) counter = 5;
1616

@@ -20,7 +20,7 @@ export class <%= className %> extends LitElement {
2020

2121
render() {
2222
return html`
23-
<h2>${this.title} Nr. ${this.counter}!</h2>
23+
<h2>${this.header} Nr. ${this.counter}!</h2>
2424
<button @click=${this.__increment}>increment</button>
2525
`;
2626
}

src/generators/wc-lit-element-ts/templates/static/demo/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
import { html, render } from 'lit';
1616
import '../dist/src/<%= tagName %>.js';
1717

18-
const title = 'Hello owc World!';
18+
const header = 'Hello owc World!';
1919
render(
2020
html`
21-
<<%= tagName %> .title=${title}>
21+
<<%= tagName %> .header=${header}>
2222
some light-dom
2323
</<%= tagName %>>
2424
`,

src/generators/wc-lit-element/templates/static/demo/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
import { html, render } from 'lit';
1616
import '../<%= tagName %>.js';
1717

18-
const title = 'Hello owc World!';
18+
const header = 'Hello owc World!';
1919
render(
2020
html`
21-
<<%= tagName %> .title=${title}>
21+
<<%= tagName %> .header=${header}>
2222
some light-dom
2323
</<%= tagName %>>
2424
`,

test/snapshots/fully-loaded-app/stories/scaffold-app.stories.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ export default {
99
},
1010
};
1111

12-
function Template({ title, backgroundColor }) {
12+
function Template({ header, backgroundColor }) {
1313
return html`
1414
<scaffold-app
1515
style="--scaffold-app-background-color: ${backgroundColor || 'white'}"
16-
.title=${title}
16+
.header=${header}
1717
>
1818
</scaffold-app>
1919
`;
2020
}
2121

2222
export const App = Template.bind({});
2323
App.args = {
24-
title: 'My app',
24+
header: 'My app',
2525
};

0 commit comments

Comments
 (0)