Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

feat(chips): Expose method to begin chip exit animation #2845

Merged
merged 8 commits into from
Jun 4, 2018

Conversation

bonniezhou
Copy link
Contributor

@bonniezhou bonniezhou commented May 30, 2018

This is necessary for users to allow deleting a chip without interacting with the trailing remove icon. A common use case of this is deleting the last chip by pressing the backspace key in an input.

The exit animation shrinks the chip until it's invisible. Once the animation finishes, the MDCChip:removal event will be fired to actually remove the chip from the page.

@bonniezhou bonniezhou requested a review from kfranqueiro May 30, 2018 23:21
@@ -202,3 +202,9 @@ test('#isSelected proxies to foundation', () => {
component.isSelected();
td.verify(mockFoundation.isSelected());
});

test('#beginExit adds `mdc-chip--exit` class', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reuse constant in test description and assertion

demos/chips.html Outdated
@@ -281,8 +285,17 @@ <h2>Custom theme</h2>
root && inputChipSetEl.removeChild(root);
}

function deleteLastChip(evt) {
if (evt.type === 'click' || evt.key === 'Enter' || evt.keyCode === 13) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if is unnecessary; this function is only used in response to click which already triggers on enter/space for buttons.

@codecov-io
Copy link

codecov-io commented May 31, 2018

Codecov Report

Merging #2845 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2845      +/-   ##
==========================================
+ Coverage   98.39%   98.39%   +<.01%     
==========================================
  Files          98       98              
  Lines        4182     4184       +2     
  Branches      532      532              
==========================================
+ Hits         4115     4117       +2     
  Misses         67       67
Impacted Files Coverage Δ
packages/mdc-chips/chip/index.js 76.36% <100%> (+0.89%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5f4454a...f527fb3. Read the comment docs.

Copy link
Contributor

@kfranqueiro kfranqueiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more nit, otherwise LGTM

demos/chips.html Outdated
@@ -281,8 +285,15 @@ <h2>Custom theme</h2>
root && inputChipSetEl.removeChild(root);
}

function deleteLastChip(evt) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: evt is unused and can be omitted

@bonniezhou bonniezhou merged commit eb00fd3 into master Jun 4, 2018
@kfranqueiro kfranqueiro deleted the feat/chips/exit branch August 1, 2018 16:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants