File tree Expand file tree Collapse file tree 2 files changed +16
-15
lines changed Expand file tree Collapse file tree 2 files changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -107,21 +107,6 @@ describe('MatSlider', () => {
107
107
} ,
108
108
) ;
109
109
} ) ;
110
-
111
- it ( 'should have "auto" cursor on thumb input when slider is disabled' , async ( ) => {
112
- const slider = getStandardSlider ( ) ;
113
- // Disable the slider using a script since there's no direct API in protractor
114
- // to set component properties and trigger change detection easily for this specific setup.
115
- await browser . executeScript ( 'arguments[0].disabled = true;' , slider . getWebElement ( ) ) ;
116
-
117
- // It might take a moment for the disabled styles to apply.
118
- // A small wait can help, though ideally, there'd be a more robust way to detect this.
119
- await browser . sleep ( 100 ) ; // Wait for styles to apply, adjust if needed.
120
-
121
- const thumbInput = slider . element ( by . css ( '.mdc-slider__input' ) ) ;
122
- const cursorStyle = await thumbInput . getCssValue ( 'cursor' ) ;
123
- expect ( cursorStyle ) . toBe ( 'auto' ) ;
124
- } ) ;
125
110
} ) ;
126
111
127
112
/** Returns the current value of the slider. */
Original file line number Diff line number Diff line change @@ -563,6 +563,22 @@ describe('MatSlider', () => {
563
563
it ( 'should set the disabled attribute on the input element' , ( ) => {
564
564
expect ( input . _hostElement . disabled ) . toBeTrue ( ) ;
565
565
} ) ;
566
+
567
+ it ( 'should have "auto" cursor on thumb input when slider is disabled' , ( ) => {
568
+ // The beforeEach already creates a DisabledSlider component fixture and detects changes.
569
+ // We can directly access `input` (MatSliderThumb) and its `_hostElement`.
570
+ // The slider is disabled by default in this setup.
571
+ // fixture.detectChanges() might be needed if there were any dynamic changes
572
+ // but here we are checking the initial state of a disabled slider.
573
+ // However, calling it ensures the component is stable and styles are applied.
574
+ const fixture = TestBed . createComponent ( DisabledSlider ) ;
575
+ fixture . detectChanges ( ) ;
576
+ const sliderDebugElement = fixture . debugElement . query ( By . directive ( MatSlider ) ) ;
577
+ const slider = sliderDebugElement . componentInstance ;
578
+ const inputThumb = slider . _getInput ( _MatThumb . END ) as MatSliderThumb ;
579
+ const thumbInputElement = inputThumb . _hostElement ;
580
+ expect ( getComputedStyle ( thumbInputElement ) . cursor ) . toBe ( 'auto' ) ;
581
+ } ) ;
566
582
} ) ;
567
583
568
584
describe ( 'disabled range slider' , ( ) => {
You can’t perform that action at this time.
0 commit comments