Skip to content

Commit

Permalink
refactor!: rename clear button to remove button (#2809)
Browse files Browse the repository at this point in the history
  • Loading branch information
vursen authored Oct 11, 2021
1 parent 3ee2bcb commit a9f301b
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions packages/upload/src/vaadin-upload-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import './vaadin-upload-icons.js';
* `commands` | Container for file command icons
* `start-button` | Start file upload button
* `retry-button` | Retry file upload button
* `clear-button` | Clear file button
* `remove-button` | Remove file button
* `progress`| Progress bar
*
* The following state attributes are available for styling:
Expand Down Expand Up @@ -100,10 +100,10 @@ class UploadFile extends ThemableMixin(PolymerElement) {
></button>
<button
type="button"
part="clear-button"
part="remove-button"
file-event="file-abort"
on-click="_fireFileEvent"
aria-label$="[[i18n.file.clear]]"
aria-label$="[[i18n.file.remove]]"
aria-describedby="name"
></button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/upload/src/vaadin-upload.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ declare class Upload extends ThemableMixin(ElementMixin(HTMLElement)) {
* file: {
* retry: 'Retry',
* start: 'Start',
* clear: 'Clear'
* remove: 'Remove'
* },
* units: {
* size: ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
Expand Down
4 changes: 2 additions & 2 deletions packages/upload/src/vaadin-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
* file: {
* retry: 'Retry',
* start: 'Start',
* clear: 'Clear'
* remove: 'Remove'
* },
* units: {
* size: ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
Expand Down Expand Up @@ -424,7 +424,7 @@ class Upload extends ElementMixin(ThemableMixin(PolymerElement)) {
file: {
retry: 'Retry',
start: 'Start',
clear: 'Clear'
remove: 'Remove'
},
units: {
size: ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
Expand Down
8 changes: 4 additions & 4 deletions packages/upload/test/a11y.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('a11y', () => {
file: {
start: 'Start',
retry: 'Retry',
clear: 'clear'
remove: 'Remove'
}
};
uploadFileElement.i18n = i18n;
Expand Down Expand Up @@ -86,9 +86,9 @@ describe('a11y', () => {
});
});

describe('clear button', () => {
describe('remove button', () => {
beforeEach(() => {
button = uploadFileElement.shadowRoot.querySelector('[part=clear-button]');
button = uploadFileElement.shadowRoot.querySelector('[part=remove-button]');
});

it('should be a <button> element', () => {
Expand All @@ -100,7 +100,7 @@ describe('a11y', () => {
});

it('should have aria-label attribute', () => {
expect(button.getAttribute('aria-label')).to.equal(i18n.file.clear);
expect(button.getAttribute('aria-label')).to.equal(i18n.file.remove);
});
});
});
Expand Down
8 changes: 4 additions & 4 deletions packages/upload/test/file-list.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ describe('file list', () => {
files.forEach((file) => upload._addFile(file));
await nextFrame();

const clearButton1 = getFileListItems(upload)[0].shadowRoot.querySelector('[part="clear-button"]');
clearButton1.click();
const removeButton1 = getFileListItems(upload)[0].shadowRoot.querySelector('[part="remove-button"]');
removeButton1.click();
await nextFrame();
expect(getFileListItems(upload).length).to.equal(1);

const clearButton2 = getFileListItems(upload)[0].shadowRoot.querySelector('[part="clear-button"]');
clearButton2.click();
const removeButton2 = getFileListItems(upload)[0].shadowRoot.querySelector('[part="remove-button"]');
removeButton2.click();
await nextFrame();
expect(getFileListItems(upload).length).to.equal(0);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/upload/test/keyboard-navigation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('keyboard navigation', () => {
});

it('should focus on the clear button', async () => {
const removeButton = fileElement.shadowRoot.querySelector('[part=clear-button]');
const removeButton = fileElement.shadowRoot.querySelector('[part=remove-button]');

await repeatTab(5);

Expand Down
2 changes: 1 addition & 1 deletion packages/upload/theme/lumo/vaadin-upload-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ const uploadFile = css`
content: var(--lumo-icons-reload);
}
[part='clear-button']::before {
[part='remove-button']::before {
content: var(--lumo-icons-cross);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/upload/theme/material/vaadin-upload-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ registerStyles(
outline: none;
}
[part='clear-button'] {
[part='remove-button'] {
margin-right: -8px;
}
Expand All @@ -194,7 +194,7 @@ registerStyles(
content: var(--material-icons-reload);
}
[part='clear-button']::before {
[part='remove-button']::before {
content: var(--material-icons-clear);
}
Expand Down

0 comments on commit a9f301b

Please sign in to comment.