1.4.1 • Published 2 years ago
mahal-test-utils v1.4.1
mahal-test-utils
Official library for testing mahal application
Installation
npm i mahal-test-utils
Docs
initiate
component can be initiated by calling initiate
method
import Counter from "../src/components/counter";
import { initiate } from "mahal-test-utils";
const component = await initiate(Counter);
mount
component can be mounted by calling mount
method
import Counter from "../src/components/counter";
import { mount } from "mahal-test-utils";
const component = await mount(Counter);
setInputValue
setInputValue can be used to set the value of an input element. It takes two arguments -
- input element
- value to set
import Counter from "../src/components/counter";
import { mount } from "mahal-test-utils";
const component = await mount(Counter);
const inputEl = component.find('input');
setInputValue(inputEl, 'hello')
Pass app instance
Let's say you want to use your app instance because it contains different global value e.g - formatters, global variables etc.
In order to do that you just need to change the context of the available testing methods.
Let's see an example of mount
-
import Counter from "../src/components/counter";
import { mount } from "mahal-test-utils";
import { app } from "../src/index.ts";
const component = await mount.call(app, Counter);
1.2.0
2 years ago
1.3.5
2 years ago
1.3.4
2 years ago
1.3.3
2 years ago
1.4.1
2 years ago
1.3.2
2 years ago
1.4.0
2 years ago
1.2.2
2 years ago
1.3.0
2 years ago
1.2.1
2 years ago
1.1.5
2 years ago
1.1.1
2 years ago
1.1.4
2 years ago
1.1.3
2 years ago
1.1.0
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago
0.3.0
2 years ago
0.5.0
2 years ago
0.4.0
2 years ago
0.2.0
3 years ago