@instructure/ui-test-locator
TypeScript icon, indicating that this package has built-in type declarations

8.55.0 • Public • Published

category: packages

ui-test-locator

npm MIT License Code of Conduct

A locator component for finding components by their defined selector in tests.

Installation

npm install @instructure/ui-test-locator

Usage

// MyComponent.js
import { testable } from '@instructure/ui-testable'

@testable()
export class MyComponent extends React.Component {
  ...
}

// MyComponentLocator.js
import { locator } from '@instructure/ui-test-locator'
import { MyComponent } from './MyComponent'

export const MyComponentLocator = locator(MyComponent.selector)

// MyComponent.test.js
import { MyComponent } from './MyComponent'
import { MyComponentLocator } from './MyComponentLocator.js'

it('should render', () => {
  await mount(<MyComponent />)

  const myComponent = await MyComponentLocator.find()

  expect(myComponent).to.exist()
})

Readme

Keywords

none

Package Sidebar

Install

npm i @instructure/ui-test-locator

Weekly Downloads

7,754

Version

8.55.0

License

MIT

Unpacked Size

192 kB

Total Files

17

Last publish

Collaborators

  • bpjatacsuk
  • ajmal-esa
  • razorsh4rk
  • david.wenzlick.inst
  • robinkuss64
  • ardena
  • jcflow
  • jguardadom
  • jdewar
  • xcudder
  • ericsaupe
  • joyenjoyer
  • omarpr
  • cguanzon-inst
  • sarahgerard
  • jacksonhowe
  • jakeoeding
  • camray
  • cjs118
  • matyas.szabo
  • herrtopi
  • angela.gomba
  • kyler-instructure
  • instuici
  • eschiebel
  • maths22
  • jcrystal
  • skacsmark
  • itadmins
  • quizzesuici
  • instructure-toolsmiths-service-user
  • aogata-inst
  • instout