Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

$mdToast: should hide after duration tests false positive #2728

Closed
adamweeks opened this issue May 5, 2015 · 1 comment
Closed

$mdToast: should hide after duration tests false positive #2728

adamweeks opened this issue May 5, 2015 · 1 comment

Comments

@adamweeks
Copy link
Contributor

In the toast.spec.js file, there is a unit test for 'should hide after duration' that gives a false positive:

 it('should hide after duration', inject(function($timeout, $animate, $rootElement) {
        var parent = angular.element('<div>');
        setup({
          template: '<md-toast />',
          hideTimeout: 1234
        });
        expect($rootElement.find('md-toast').length).toBe(1);
        $timeout.flush();
        expect($rootElement.find('md-toast').length).toBe(0);
      }));

https:/angular/material/blob/master/src/components/toast/toast.spec.js#L151

In the setup command, it passes an option hideTimeout. This option should be hideDelay. The test passes because there is an auto-hide on null hideDelay options.

This test would fail if the $timeout.flush() was changed to $timeout.flush(1234).

adamweeks added a commit to adamweeks/material that referenced this issue May 5, 2015
In the `should hide after duration` unit test, an option value is provided to the parameter
`hideTimeout`. This option is not valid and should be `hideDelay`. The test passes
because the toast will default to hide after 3000 anyway.

angular#2728
@popthestack
Copy link

👍

@ThomasBurleson ThomasBurleson modified the milestone: Backlog May 28, 2015
Splaktar pushed a commit that referenced this issue Jul 4, 2015
In the `should hide after duration` unit test, an option value is provided to the parameter
`hideTimeout`. This option is not valid and should be `hideDelay`. The test passes
because the toast will default to hide after 3000 anyway.

Fixes #2728. Closes #2729.
@Splaktar Splaktar removed this from the - Backlog milestone Feb 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants