File tree Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 5555 "babel-preset-stage-0" : " ^6.16.0" ,
5656 "chai" : " ^3.5.0" ,
5757 "chai-enzyme" : " ^0.6.1" ,
58+ "cheerio" : " ^0.22.0" ,
5859 "css-loader" : " ^0.26.0" ,
5960 "css-modules-require-hook" : " ^4.0.5" ,
6061 "dirty-chai" : " ^1.2.2" ,
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import { Entity } from 'draft-js' ;
3+ import { shallow } from 'enzyme' ;
4+ import chai , { expect } from 'chai' ;
5+ import chaiEnzyme from 'chai-enzyme' ;
6+
7+ import Image from '../' ;
8+
9+ chai . use ( chaiEnzyme ( ) ) ;
10+
11+ describe ( '<Image />' , ( ) => {
12+ it ( 'renders anchor tag' , ( ) => {
13+ const entityKey = Entity . create ( 'IMG' , 'MUTABLE' , {
14+ alt : 'alt' ,
15+ src : 'http://cultofthepartyparrot.com/parrots/aussieparrot.gif' ,
16+ title : 'parrot'
17+ } ) ;
18+ expect (
19+ shallow ( < Image entityKey = { entityKey } > </ Image > ) . html ( )
20+ ) . to . equal (
21+ '<span> <img src="http://cultofthepartyparrot.com/parrots/aussieparrot.gif" alt="alt" title="parrot"/></span>'
22+ ) ;
23+ } ) ;
24+ } ) ;
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import { Entity } from 'draft-js' ;
3+ import { shallow } from 'enzyme' ;
4+ import chai , { expect } from 'chai' ;
5+ import chaiEnzyme from 'chai-enzyme' ;
6+
7+ import Link from '../' ;
8+
9+ chai . use ( chaiEnzyme ( ) ) ;
10+
11+ describe ( '<Link />' , ( ) => {
12+ it ( 'renders anchor tag' , ( ) => {
13+ const entityKey = Entity . create ( 'LINK' , 'MUTABLE' , {
14+ href : 'http://cultofthepartyparrot.com/' ,
15+ title : 'parrot'
16+ } ) ;
17+ expect (
18+ shallow ( < Link entityKey = { entityKey } > < b > Hello</ b > </ Link > ) . html ( )
19+ ) . to . equal (
20+ '<a href="http://cultofthepartyparrot.com/" title="parrot"><b>Hello</b></a>'
21+ ) ;
22+ } ) ;
23+ } ) ;
You can’t perform that action at this time.
0 commit comments