Skip to content

Commit 0c7968d

Browse files
committed
Updated output messages
1 parent cb481ee commit 0c7968d

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

packages/dom/src/lib/ElementAssertion.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,13 @@ export class ElementAssertion<T extends Element> extends Assertion<T> {
154154
const error = new AssertionError({
155155
actual: this.actual,
156156
expected: document.activeElement,
157-
message: "Expected the element to have focus.",
157+
message: "Expected the element to be focused",
158158
});
159159

160160
const invertedError = new AssertionError({
161161
actual: this.actual,
162162
expected: document.activeElement,
163-
message: "Expected the element not to have focus.",
163+
message: "Expected the element NOT to be focused",
164164
});
165165

166166
return this.execute({

packages/dom/test/unit/lib/ElementAssertion.test.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -278,21 +278,19 @@ describe("[Unit] ElementAssertion.test.ts", () => {
278278

279279
expect(() => test.not.toHaveFocus())
280280
.toThrowError(AssertionError)
281-
.toHaveMessage("Expected the element not to have focus.");
281+
.toHaveMessage("Expected the element NOT to be focused");
282282
});
283283
});
284284

285285
context("when the element does not have focus", () => {
286286
it("throws an assertion error", () => {
287287
const { getByTestId } = render(<FocusTestComponent />);
288288
const input1 = getByTestId("input1");
289-
const input2 = getByTestId("input2");
290-
input1.focus();
291-
const test = new ElementAssertion(input2);
289+
const test = new ElementAssertion(input1);
292290

293291
expect(() => test.toHaveFocus())
294292
.toThrowError(AssertionError)
295-
.toHaveMessage("Expected the element to have focus.");
293+
.toHaveMessage("Expected the element to be focused");
296294

297295
expect(test.not.toHaveFocus()).toBeEqual(test);
298296
});

0 commit comments

Comments
 (0)