protractor icon indicating copy to clipboard operation
protractor copied to clipboard

how to test styles applied to an input box when data entered is invalid

Open nehaw07 opened this issue 11 years ago • 1 comments

I have an input that has attribute max='10000'. When the input is focused or when the value entered is less that 10000 the border-color of the input is '#026fbe' i.e. some blue when the value inserted is greater than 10000 the value is invalid and the border-color changes to red '#F30000'. I want to test these style using Protractor.

The styling is being handled in the code via ':host' so when the value to input is invalid the following code updates the styles. :host([invalid]) input[is="px-base-input"], input[is="px-base-input"]:invalid { border-color:#f30000!important; box-shadow:0px 2px 0px rgba(0,0,0,.02), 0px 2px 15px rgba(243,0,0,.2), inset 0px 2px 5px rgba(243,0,0,.1); }

I tried using expect(element.getCssValue('border-color').toEqual('#F30000'') but it returns the border color as an rgb value and that too incorrect.

nehaw07 avatar Sep 01 '15 10:09 nehaw07

Please direct general support questions like this one to an appropriate support channel, see https://github.com/angular/protractor/blob/master/CONTRIBUTING.md#questions

Thank you!

juliemr avatar Sep 23 '15 18:09 juliemr