update tests to use :state()

This commit is contained in:
Cory LaViska
2024-12-17 11:30:19 -05:00
parent 543fa3c85c
commit 1855d1b809

View File

@@ -184,7 +184,7 @@ function runAllValidityTests(
control.customError = 'MyError';
await control.updateComplete;
expect(control.validity.valid).to.equal(false);
expect(control.hasAttribute('data-wa-invalid')).to.equal(true);
expect(control.hasCustomState('invalid')).to.equal(true);
expect(control.validationMessage).to.equal('MyError');
});
@@ -193,7 +193,7 @@ function runAllValidityTests(
// expect(control.validity.valid).to.equal(true)
control.setAttribute('custom-error', 'MyError');
await control.updateComplete;
expect(control.hasAttribute('data-wa-invalid')).to.equal(true);
expect(control.hasCustomState('invalid')).to.equal(true);
expect(control.validationMessage).to.equal('MyError');
});
@@ -207,7 +207,7 @@ function runAllValidityTests(
expect(control.disabled).to.equal(true);
// expect(control.hasAttribute("disabled")).to.equal(false)
expect(control.matches(':disabled')).to.equal(true);
expect(control.hasAttribute('data-wa-disabled')).to.equal(true);
expect(control.hasCustomState('disabled')).to.equal(true);
fieldset.disabled = false;
@@ -215,7 +215,7 @@ function runAllValidityTests(
expect(control.disabled).to.equal(false);
expect(control.hasAttribute('disabled')).to.equal(false);
expect(control.matches(':disabled')).to.equal(false);
expect(control.hasAttribute('data-wa-disabled')).to.equal(false);
expect(control.hasCustomState('disabled')).to.equal(false);
});
// it("This is the one edge case with ':disabled'. If you disable a fieldset, and then disable the element directly, it will not reflect the disabled attribute.", async () => {
@@ -246,7 +246,7 @@ function runAllValidityTests(
expect(control.disabled).to.equal(true);
expect(control.hasAttribute('disabled')).to.equal(true);
expect(control.matches(':disabled')).to.equal(true);
expect(control.hasAttribute('data-wa-disabled')).to.equal(true);
expect(control.hasCustomState('disabled')).to.equal(true);
control.disabled = false;
await control.updateComplete;
@@ -254,7 +254,7 @@ function runAllValidityTests(
expect(control.disabled).to.equal(false);
expect(control.hasAttribute('disabled')).to.equal(false);
expect(control.matches(':disabled')).to.equal(false);
expect(control.hasAttribute('data-wa-disabled')).to.equal(false);
expect(control.hasCustomState('disabled')).to.equal(false);
});
}
});