@@ -42,9 +42,8 @@ export function toBeAttached(
4242) {
4343 const attached = ! options || options . attached === undefined || options . attached ;
4444 const expected = attached ? 'attached' : 'detached' ;
45- const unexpected = attached ? 'detached' : 'attached' ;
4645 const arg = attached ? '' : '{ attached: false }' ;
47- return toBeTruthy . call ( this , 'toBeAttached' , locator , 'Locator' , expected , unexpected , arg , async ( isNot , timeout ) => {
46+ return toBeTruthy . call ( this , 'toBeAttached' , locator , 'Locator' , expected , arg , async ( isNot , timeout ) => {
4847 return await locator . _expect ( attached ? 'to.be.attached' : 'to.be.detached' , { isNot, timeout } ) ;
4948 } , options ) ;
5049}
@@ -56,9 +55,8 @@ export function toBeChecked(
5655) {
5756 const checked = ! options || options . checked === undefined || options . checked ;
5857 const expected = checked ? 'checked' : 'unchecked' ;
59- const unexpected = checked ? 'unchecked' : 'checked' ;
6058 const arg = checked ? '' : '{ checked: false }' ;
61- return toBeTruthy . call ( this , 'toBeChecked' , locator , 'Locator' , expected , unexpected , arg , async ( isNot , timeout ) => {
59+ return toBeTruthy . call ( this , 'toBeChecked' , locator , 'Locator' , expected , arg , async ( isNot , timeout ) => {
6260 return await locator . _expect ( checked ? 'to.be.checked' : 'to.be.unchecked' , { isNot, timeout } ) ;
6361 } , options ) ;
6462}
@@ -68,7 +66,7 @@ export function toBeDisabled(
6866 locator : LocatorEx ,
6967 options ?: { timeout ?: number } ,
7068) {
71- return toBeTruthy . call ( this , 'toBeDisabled' , locator , 'Locator' , 'disabled' , 'enabled' , ' ', async ( isNot , timeout ) => {
69+ return toBeTruthy . call ( this , 'toBeDisabled' , locator , 'Locator' , 'disabled' , '' , async ( isNot , timeout ) => {
7270 return await locator . _expect ( 'to.be.disabled' , { isNot, timeout } ) ;
7371 } , options ) ;
7472}
@@ -80,9 +78,8 @@ export function toBeEditable(
8078) {
8179 const editable = ! options || options . editable === undefined || options . editable ;
8280 const expected = editable ? 'editable' : 'readOnly' ;
83- const unexpected = editable ? 'readOnly' : 'editable' ;
8481 const arg = editable ? '' : '{ editable: false }' ;
85- return toBeTruthy . call ( this , 'toBeEditable' , locator , 'Locator' , expected , unexpected , arg , async ( isNot , timeout ) => {
82+ return toBeTruthy . call ( this , 'toBeEditable' , locator , 'Locator' , expected , arg , async ( isNot , timeout ) => {
8683 return await locator . _expect ( editable ? 'to.be.editable' : 'to.be.readonly' , { isNot, timeout } ) ;
8784 } , options ) ;
8885}
@@ -92,7 +89,7 @@ export function toBeEmpty(
9289 locator : LocatorEx ,
9390 options ?: { timeout ?: number } ,
9491) {
95- return toBeTruthy . call ( this , 'toBeEmpty' , locator , 'Locator' , 'empty' , 'notEmpty' , ' ', async ( isNot , timeout ) => {
92+ return toBeTruthy . call ( this , 'toBeEmpty' , locator , 'Locator' , 'empty' , '' , async ( isNot , timeout ) => {
9693 return await locator . _expect ( 'to.be.empty' , { isNot, timeout } ) ;
9794 } , options ) ;
9895}
@@ -104,9 +101,8 @@ export function toBeEnabled(
104101) {
105102 const enabled = ! options || options . enabled === undefined || options . enabled ;
106103 const expected = enabled ? 'enabled' : 'disabled' ;
107- const unexpected = enabled ? 'disabled' : 'enabled' ;
108104 const arg = enabled ? '' : '{ enabled: false }' ;
109- return toBeTruthy . call ( this , 'toBeEnabled' , locator , 'Locator' , expected , unexpected , arg , async ( isNot , timeout ) => {
105+ return toBeTruthy . call ( this , 'toBeEnabled' , locator , 'Locator' , expected , arg , async ( isNot , timeout ) => {
110106 return await locator . _expect ( enabled ? 'to.be.enabled' : 'to.be.disabled' , { isNot, timeout } ) ;
111107 } , options ) ;
112108}
@@ -116,7 +112,7 @@ export function toBeFocused(
116112 locator : LocatorEx ,
117113 options ?: { timeout ?: number } ,
118114) {
119- return toBeTruthy . call ( this , 'toBeFocused' , locator , 'Locator' , 'focused' , 'inactive' , ' ', async ( isNot , timeout ) => {
115+ return toBeTruthy . call ( this , 'toBeFocused' , locator , 'Locator' , 'focused' , '' , async ( isNot , timeout ) => {
120116 return await locator . _expect ( 'to.be.focused' , { isNot, timeout } ) ;
121117 } , options ) ;
122118}
@@ -126,7 +122,7 @@ export function toBeHidden(
126122 locator : LocatorEx ,
127123 options ?: { timeout ?: number } ,
128124) {
129- return toBeTruthy . call ( this , 'toBeHidden' , locator , 'Locator' , 'hidden' , 'visible' , ' ', async ( isNot , timeout ) => {
125+ return toBeTruthy . call ( this , 'toBeHidden' , locator , 'Locator' , 'hidden' , '' , async ( isNot , timeout ) => {
130126 return await locator . _expect ( 'to.be.hidden' , { isNot, timeout } ) ;
131127 } , options ) ;
132128}
@@ -138,9 +134,8 @@ export function toBeVisible(
138134) {
139135 const visible = ! options || options . visible === undefined || options . visible ;
140136 const expected = visible ? 'visible' : 'hidden' ;
141- const unexpected = visible ? 'hidden' : 'visible' ;
142137 const arg = visible ? '' : '{ visible: false }' ;
143- return toBeTruthy . call ( this , 'toBeVisible' , locator , 'Locator' , expected , unexpected , arg , async ( isNot , timeout ) => {
138+ return toBeTruthy . call ( this , 'toBeVisible' , locator , 'Locator' , expected , arg , async ( isNot , timeout ) => {
144139 return await locator . _expect ( visible ? 'to.be.visible' : 'to.be.hidden' , { isNot, timeout } ) ;
145140 } , options ) ;
146141}
@@ -150,7 +145,7 @@ export function toBeInViewport(
150145 locator : LocatorEx ,
151146 options ?: { timeout ?: number , ratio ?: number } ,
152147) {
153- return toBeTruthy . call ( this , 'toBeInViewport' , locator , 'Locator' , 'in viewport' , 'outside viewport' , ' ', async ( isNot , timeout ) => {
148+ return toBeTruthy . call ( this , 'toBeInViewport' , locator , 'Locator' , 'in viewport' , '' , async ( isNot , timeout ) => {
154149 return await locator . _expect ( 'to.be.in.viewport' , { isNot, expectedNumber : options ?. ratio , timeout } ) ;
155150 } , options ) ;
156151}
@@ -232,7 +227,7 @@ export function toHaveAttribute(
232227 }
233228 }
234229 if ( expected === undefined ) {
235- return toBeTruthy . call ( this , 'toHaveAttribute' , locator , 'Locator' , 'have attribute' , 'not have attribute' , ' ', async ( isNot , timeout ) => {
230+ return toBeTruthy . call ( this , 'toHaveAttribute' , locator , 'Locator' , 'have attribute' , '' , async ( isNot , timeout ) => {
236231 return await locator . _expect ( 'to.have.attribute' , { expressionArg : name , isNot, timeout } ) ;
237232 } , options ) ;
238233 }
0 commit comments