Skip to content

Commit ad16223

Browse files
authored
refactor!: inline expect package (#10221)
1 parent 80f07ed commit ad16223

36 files changed

Lines changed: 83 additions & 70 deletions

packages/browser/src/client/tester/aria.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
import type { MatchersObject } from '@vitest/expect'
21
import type {
32
AriaNode,
43
AriaTemplateNode,
54
} from 'ivya/aria'
6-
import type { DomainMatchResult, DomainSnapshotAdapter } from 'vitest'
5+
import type {
6+
DomainMatchResult,
7+
DomainSnapshotAdapter,
8+
MatchersObject,
9+
} from 'vitest'
710
import * as aria from 'ivya/aria'
811
import { Snapshots } from 'vitest'
912
import { getBrowserState } from '../utils'

packages/browser/src/client/tester/expect/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { MatchersObject } from '@vitest/expect'
1+
import type { MatchersObject } from 'vitest'
22
import toBeChecked from './toBeChecked'
33
import toBeEmptyDOMElement from './toBeEmptyDOMElement'
44
import { toBeDisabled, toBeEnabled } from './toBeEnabled'

packages/browser/src/client/tester/expect/toBeChecked.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* copies or substantial portions of the Software.
1414
*/
1515

16-
import type { ExpectationResult, MatcherState } from '@vitest/expect'
16+
import type { MatcherResult, MatcherState } from 'vitest'
1717
import type { Locator } from '../locators'
1818
import { getAriaChecked, getAriaCheckedRoles, getAriaRole } from 'ivya/utils'
1919
import { getElementFromUserInput, isInputElement, toSentence } from './utils'
@@ -23,7 +23,7 @@ const supportedRoles = getAriaCheckedRoles()
2323
export default function toBeChecked(
2424
this: MatcherState,
2525
actual: Element | Locator,
26-
): ExpectationResult {
26+
): MatcherResult {
2727
const htmlElement = getElementFromUserInput(actual, toBeChecked, this)
2828

2929
const isValidInput = () => {

packages/browser/src/client/tester/expect/toBeEmptyDOMElement.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
* copies or substantial portions of the Software.
1414
*/
1515

16-
import type { ExpectationResult, MatcherState } from '@vitest/expect'
16+
import type { MatcherResult, MatcherState } from 'vitest'
1717
import type { Locator } from '../locators'
1818
import { getElementFromUserInput } from './utils'
1919

2020
export default function toBeEmptyDOMElement(
2121
this: MatcherState,
2222
actual: Element | Locator,
23-
): ExpectationResult {
23+
): MatcherResult {
2424
const htmlElement = getElementFromUserInput(actual, toBeEmptyDOMElement, this)
2525

2626
return {

packages/browser/src/client/tester/expect/toBeEnabled.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
* copies or substantial portions of the Software.
1414
*/
1515

16-
import type { ExpectationResult, MatcherState } from '@vitest/expect'
16+
import type { MatcherResult, MatcherState } from 'vitest'
1717
import type { Locator } from '../locators'
1818
import { getAriaDisabled } from 'ivya/utils'
1919
import { getElementFromUserInput, getTag } from './utils'
2020

2121
export function toBeDisabled(
2222
this: MatcherState,
2323
actual: Element | Locator,
24-
): ExpectationResult {
24+
): MatcherResult {
2525
const htmlElement = getElementFromUserInput(actual, toBeDisabled, this)
2626
const isDisabled = isElementDisabled(htmlElement)
2727
return {
@@ -45,7 +45,7 @@ export function toBeDisabled(
4545
export function toBeEnabled(
4646
this: MatcherState,
4747
actual: Element | Locator,
48-
): ExpectationResult {
48+
): MatcherResult {
4949
const htmlElement = getElementFromUserInput(actual, toBeEnabled, this)
5050
const isDisabled = isElementDisabled(htmlElement)
5151
return {

packages/browser/src/client/tester/expect/toBeInTheDocument.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
* copies or substantial portions of the Software.
1414
*/
1515

16-
import type { ExpectationResult, MatcherState } from '@vitest/expect'
16+
import type { MatcherResult, MatcherState } from 'vitest'
1717
import type { Locator } from '../locators'
1818
import { queryElementFromUserInput } from './utils'
1919

2020
export default function toBeInTheDocument(
2121
this: MatcherState,
2222
actual: Element | Locator | null,
23-
): ExpectationResult {
23+
): MatcherResult {
2424
let htmlElement: null | HTMLElement | SVGElement = null
2525

2626
if (actual !== null || !this.isNot) {

packages/browser/src/client/tester/expect/toBeInViewport.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
* copies or substantial portions of the Software.
1414
*/
1515

16-
import type { ExpectationResult, MatcherState } from '@vitest/expect'
16+
import type { MatcherResult, MatcherState } from 'vitest'
1717
import type { Locator } from '../locators'
1818
import { getElementFromUserInput } from './utils'
1919

2020
export default function toBeInViewport(
2121
this: MatcherState,
2222
actual: Element | Locator,
2323
options?: { ratio?: number },
24-
): ExpectationResult {
24+
): MatcherResult {
2525
const htmlElement = getElementFromUserInput(actual, toBeInViewport, this)
2626

2727
const expectedRatio = options?.ratio ?? 0

packages/browser/src/client/tester/expect/toBeInvalid.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* copies or substantial portions of the Software.
1414
*/
1515

16-
import type { ExpectationResult, MatcherState } from '@vitest/expect'
16+
import type { MatcherResult, MatcherState } from 'vitest'
1717
import type { Locator } from '../locators'
1818
import { getElementFromUserInput, getTag } from './utils'
1919

@@ -43,7 +43,7 @@ function isElementInvalid(element: HTMLElement | SVGElement) {
4343
export function toBeInvalid(
4444
this: MatcherState,
4545
element: HTMLElement | SVGElement | Locator,
46-
): ExpectationResult {
46+
): MatcherResult {
4747
const htmlElement = getElementFromUserInput(element, toBeInvalid, this)
4848

4949
const isInvalid = isElementInvalid(htmlElement)
@@ -69,7 +69,7 @@ export function toBeInvalid(
6969
export function toBeValid(
7070
this: MatcherState,
7171
element: HTMLElement | SVGElement | Locator,
72-
): ExpectationResult {
72+
): MatcherResult {
7373
const htmlElement = getElementFromUserInput(element, toBeInvalid, this)
7474

7575
const isValid = !isElementInvalid(htmlElement)

packages/browser/src/client/tester/expect/toBePartiallyChecked.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
* copies or substantial portions of the Software.
1414
*/
1515

16-
import type { ExpectationResult, MatcherState } from '@vitest/expect'
16+
import type { MatcherResult, MatcherState } from 'vitest'
1717
import type { Locator } from '../locators'
1818
import { getAriaChecked as ivyaGetAriaChecked } from 'ivya/utils'
1919
import { getElementFromUserInput, isInputElement } from './utils'
2020

2121
export default function toBePartiallyChecked(
2222
this: MatcherState,
2323
actual: Element | Locator,
24-
): ExpectationResult {
24+
): MatcherResult {
2525
const htmlElement = getElementFromUserInput(actual, toBePartiallyChecked, this)
2626

2727
const isValidInput = () => {

packages/browser/src/client/tester/expect/toBeRequired.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* copies or substantial portions of the Software.
1414
*/
1515

16-
import type { ExpectationResult, MatcherState } from '@vitest/expect'
16+
import type { MatcherResult, MatcherState } from 'vitest'
1717
import type { Locator } from '../locators'
1818
import { getElementFromUserInput, getTag } from './utils'
1919

@@ -69,7 +69,7 @@ function isElementRequiredByARIA(element: HTMLElement | SVGElement) {
6969
export default function toBeRequired(
7070
this: MatcherState,
7171
element: HTMLElement | SVGElement | Locator,
72-
): ExpectationResult {
72+
): MatcherResult {
7373
const htmlElement = getElementFromUserInput(element, toBeRequired, this)
7474

7575
const isRequired

0 commit comments

Comments
 (0)