Prismatest CSS Adapter
This adapter is used to interact with your test views using CSS selectors and native DOM APIs.
Element Type
Elements are native
HTMLElement
instances. They may be more specific depending on the element that is selected.
Selector Type
Selectors are specified using CSS selector fragments. When selectors are
combined they are joined with a space. If multiple CSS selector fragments are
specified in a single string using commas, then when they are combined the
fragments are split, combined with the next selector, and rejoined using
commas. This is effectively a cartesian product.
Quick Start
-
Install
yarn install --dev @mojotech/prismatest-css
-
Render something
import App from "./app";
import * as ReactDOM from 'react-dom';
const rendered = document.createElement('div');
ReactDOM.render(<App />, domContainer);
-
Use some test views
import testView from "@mojotech/prismatest-css";
import TodoComponent from './todo-component';
const TodoView = testView('#todo-component');
const todoInput = TodoView(testView.defaultViews.textInput).materialize(rendered);
const todoSubmit = TodoView(testView.defaultViews.button).materialize(rendered);
todoInput.enterText("Write some tests!");
todoSubmit.click();