Skip to content

Commit 4c98665

Browse files
committed
test: add harness test changes from
f537fba
1 parent cf48568 commit 4c98665

File tree

7 files changed

+30
-2
lines changed

7 files changed

+30
-2
lines changed

src/material-experimental/mdc-button/harness/button-harness.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ function runTests() {
112112
// Older versions of Edge have a bug where `disabled` buttons are still clickable if
113113
// they contain child elements. We skip this check on Edge.
114114
// See https://stackoverflow.com/questions/32377026/disabled-button-is-clickable-on-edge-browser
115-
if (platform.EDGE) {
115+
if (platform.EDGE || platform.FIREFOX) {
116116
return;
117117
}
118118

src/material-experimental/mdc-checkbox/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ ng_test_library(
7373
":mdc-checkbox",
7474
"//src/cdk-experimental/testing",
7575
"//src/cdk-experimental/testing/testbed",
76+
"//src/cdk/platform",
7677
"//src/cdk/testing",
7778
"//src/material/checkbox",
7879
"@npm//@angular/forms",

src/material-experimental/mdc-checkbox/harness/checkbox-harness.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {Platform} from '@angular/cdk/platform';
12
import {HarnessLoader} from '@angular/cdk-experimental/testing';
23
import {TestbedHarnessEnvironment} from '@angular/cdk-experimental/testing/testbed';
34
import {Component} from '@angular/core';
@@ -8,6 +9,7 @@ import {MatCheckboxModule as MatMdcCheckboxModule} from '../index';
89
import {MatCheckboxHarness} from './checkbox-harness';
910
import {MatCheckboxHarness as MatMdcCheckboxHarness} from './mdc-checkbox-harness';
1011

12+
const platform = new Platform();
1113
let fixture: ComponentFixture<CheckboxHarnessTest>;
1214
let loader: HarnessLoader;
1315
let checkboxHarness: typeof MatCheckboxHarness;
@@ -178,6 +180,12 @@ function runTests() {
178180
});
179181

180182
it('should not toggle disabled checkbox', async () => {
183+
if (platform.FIREFOX) {
184+
// do run this test on firefox as click events on the label of a disabled checkbox
185+
// cause the value to be changed. https://bugzilla.mozilla.org/show_bug.cgi?id=1540995
186+
return;
187+
}
188+
181189
const disabledCheckbox = await loader.getHarness(checkboxHarness.with({label: 'Second'}));
182190
expect(await disabledCheckbox.isChecked()).toBe(false);
183191
await disabledCheckbox.toggle();

src/material-experimental/mdc-radio/harness/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ ng_test_library(
2121
":harness",
2222
"//src/cdk-experimental/testing",
2323
"//src/cdk-experimental/testing/testbed",
24+
"//src/cdk/platform",
2425
"//src/material/radio",
2526
"@npm//@angular/forms",
2627
],

src/material-experimental/mdc-radio/harness/radio-harness.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {Platform} from '@angular/cdk/platform';
12
import {HarnessLoader} from '@angular/cdk-experimental/testing';
23
import {TestbedHarnessEnvironment} from '@angular/cdk-experimental/testing/testbed';
34
import {Component} from '@angular/core';
@@ -6,6 +7,7 @@ import {ReactiveFormsModule} from '@angular/forms';
67
import {MatRadioModule} from '@angular/material/radio';
78
import {MatRadioButtonHarness, MatRadioGroupHarness} from './radio-harness';
89

10+
const platform = new Platform();
911
let fixture: ComponentFixture<MultipleRadioButtonsHarnessTest>;
1012
let loader: HarnessLoader;
1113
let radioButtonHarness: typeof MatRadioButtonHarness;
@@ -238,6 +240,13 @@ function runRadioButtonTests() {
238240
});
239241

240242
it('should not be able to check disabled radio-button', async () => {
243+
if (platform.FIREFOX) {
244+
// do run this test on firefox as click events on the label of the underlying
245+
// input checkbox cause the value to be changed. Read more in the bug report:
246+
// https://bugzilla.mozilla.org/show_bug.cgi?id=1540995
247+
return;
248+
}
249+
241250
fixture.componentInstance.disableAll = true;
242251
fixture.detectChanges();
243252

src/material-experimental/mdc-slide-toggle/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ ng_test_library(
7373
"//src/cdk-experimental/testing",
7474
"//src/cdk-experimental/testing/testbed",
7575
"//src/cdk/bidi",
76+
"//src/cdk/platform",
7677
"//src/cdk/testing",
7778
"//src/material/slide-toggle",
7879
"@npm//@angular/forms",

src/material-experimental/mdc-slide-toggle/harness/slide-toggle-harness.spec.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {Platform} from '@angular/cdk/platform';
12
import {HarnessLoader} from '@angular/cdk-experimental/testing';
23
import {TestbedHarnessEnvironment} from '@angular/cdk-experimental/testing/testbed';
34
import {Component} from '@angular/core';
@@ -8,7 +9,7 @@ import {MatSlideToggleModule as MatMdcSlideToggleModule} from '../index';
89
import {MatSlideToggleHarness} from './slide-toggle-harness';
910
import {MatSlideToggleHarness as MatMdcSlideToggleHarness} from './mdc-slide-toggle-harness';
1011

11-
12+
const platform = new Platform();
1213
let fixture: ComponentFixture<SlideToggleHarnessTest>;
1314
let loader: HarnessLoader;
1415
let slideToggleHarness: typeof MatSlideToggleHarness;
@@ -160,6 +161,13 @@ function runTests() {
160161
});
161162

162163
it('should not toggle disabled slide-toggle', async () => {
164+
if (platform.FIREFOX) {
165+
// do run this test on firefox as click events on the label of the underlying
166+
// input checkbox cause the value to be changed. Read more in the bug report:
167+
// https://bugzilla.mozilla.org/show_bug.cgi?id=1540995
168+
return;
169+
}
170+
163171
const disabledToggle = await loader.getHarness(slideToggleHarness.with({label: 'Second'}));
164172
expect(await disabledToggle.isChecked()).toBe(false);
165173
await disabledToggle.toggle();

0 commit comments

Comments
 (0)