-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(material/core): ripples persisting when container is removed from…
… DOM while fading-in Follow-up to 65fb5f4. We recently changed how animations are handled in the ripple. As part of this change we accidentally broke the select <> ripple interaction. The select is special because the option panel is removed from the DOM as soon as an option got clicked. An option click will trigger a ripple that will usually still fade-in when the panel is removed. Currently such ripples never will complete because the `transitionend` event does not fire once removed from DOM. We should destroy the ripples when the transition is canceled (e.g. through DOM removal).
- Loading branch information
1 parent
8a12da7
commit e6bd320
Showing
11 changed files
with
138 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {NgModule} from '@angular/core'; | ||
import {ExampleViewerModule} from '../example-viewer/example-viewer-module'; | ||
import {SelectE2e} from './select-e2e'; | ||
|
||
@NgModule({ | ||
imports: [ExampleViewerModule], | ||
declarations: [SelectE2e], | ||
}) | ||
export class SelectE2eModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {Component} from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'select-demo', | ||
template: `<example-list-viewer [ids]="examples"></example-list-viewer>`, | ||
}) | ||
export class SelectE2e { | ||
examples = ['select-overview']; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import {browser, by, element, ExpectedConditions} from 'protractor'; | ||
import {getElement} from '../../cdk/testing/private/e2e'; | ||
|
||
const presenceOf = ExpectedConditions.presenceOf; | ||
const not = ExpectedConditions.not; | ||
|
||
describe('select', () => { | ||
beforeEach(async () => await browser.get('/select?animations=true')); | ||
|
||
// Regression test which ensures that ripples within the select are not persisted | ||
// accidentally. This could happen because the select panel is removed from DOM | ||
// immediately when an option is clicked. Usually ripples still fade-in at that point. | ||
it('should not accidentally persist ripples', async () => { | ||
const select = getElement('.mat-select'); | ||
const options = element.all(by.css('.mat-option')); | ||
const ripples = element.all(by.css('.mat-ripple-element')); | ||
|
||
// Wait for select to be rendered. | ||
await browser.wait(presenceOf(select)); | ||
|
||
// Opent the select and wait for options to be displayed. | ||
await select.click(); | ||
await browser.wait(presenceOf(options.get(0))); | ||
|
||
// Click the first option and wait for the select to be closed. | ||
await options.get(0).click(); | ||
await browser.wait(not(presenceOf(options.get(0)))); | ||
|
||
// Re-open the select and wait for it to be rendered. | ||
await select.click(); | ||
await browser.wait(presenceOf(options.get(0))); | ||
|
||
// Expect no ripples to be showing up without an option click. | ||
expect(await ripples.isPresent()).toBe(false); | ||
}); | ||
}); |