Skip to content

Select and Option component not working with tests in Karma #5082

@YoannBureau

Description

@YoannBureau

Bug :

Select component from Angular Material don't load Option components in Karma

What is the expected behavior?

Using Karma & testbed, I should be able to fetch Option components related to my Select component instance

What is the current behavior?

Only the Select is displayed, and if I fetch for Options, I find nothing. The same in Karma preview : if I click on the Select, nothing happens (i.e. no option is shown)

What are the steps to reproduce?

  1. Create a new CLI project
  2. Install and import angular material
  3. In the app.component.html file, add a Select components with options, such as :
    <md-select placeholder="Favorite food"> <md-option [value]="1">1</md-option> <md-option [value]="2">2</md-option> <md-option [value]="3">3</md-option> </md-select>
  4. Launch Karma (ng test command) and see that there is nothing inside the Select component instance

What is the use-case or motivation for changing an existing behavior?

Allow us to unit test our pages using Select components

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

"@angular/animations": "^4.1.3",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/material": "^2.0.0-beta.6",

Is there anything else we should know?

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