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

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

Closed
@adamweeks

Description

@adamweeks

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://github.com/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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions