File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,4 +94,25 @@ Test(<TestComponent/>)
9494
9595~~~
9696
97+ ##mixin
98+
99+ Use ` .mixin ` if you want to add new middleware as methods to ` Test ` . This gives a more natural way of using middleware:
100+
101+ ~~~ js
102+ // In this example, CustomFind middleware was added to Test by mixin
103+ // and used if as it was a method on Test itself.
104+
105+ Test (< TestComponent / > )
106+ .mixin ({
107+ customFind: CustomFind
108+ })
109+ .customFind (' cells' , ' table td' )
110+ .element (' cells' , cells => {
111+ expect (cells .length ).to .be .equal (10 )
112+ })
113+
114+ ~~~
115+
116+
117+
97118You can see more examples in the tests directory.
Original file line number Diff line number Diff line change 1+ import React from 'react'
2+
3+ import Test from '../src/legit-tests'
4+ import { Find } from '../src/middleware'
5+ import { expect } from 'chai'
6+
7+ import { TestComponent } from './components'
8+
9+ describe ( 'Mixin method' , ( ) => {
10+
11+ it ( 'should add Find as method to Test' , ( ) => {
12+ Test ( < TestComponent /> )
13+ . mixin ( {
14+ customFind : Find
15+ } )
16+ . customFind ( 'div' )
17+ . element ( 'div' , div => {
18+ expect ( div . length ) . to . equal ( 2 )
19+ } )
20+ } )
21+
22+ } )
You can’t perform that action at this time.
0 commit comments