File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 44 "description" : " A react markdown-editor like Stackoverflow and Github" ,
55 "main" : " index.js" ,
66 "scripts" : {
7+ "test" : " mocha --timeout 15000 --compilers js:babel-register ./test/*Spec.js" ,
78 "start" : " cross-env NODE_ENV=development babel-node ./demo/server.js" ,
89 "build" : " cross-env NODE_ENV=production gulp build"
910 },
3031 "babel-preset-react-hmre" : " ^1.1.1" ,
3132 "babel-preset-stage-0" : " ^6.16.0" ,
3233 "bootstrap" : " ^4.0.0-alpha.5" ,
34+ "chai" : " ^3.5.0" ,
3335 "colors" : " ^1.1.2" ,
3436 "cross-env" : " ^3.1.3" ,
3537 "css-loader" : " ^0.26.0" ,
4143 "gulp-cli" : " ^1.2.2" ,
4244 "less" : " ^2.7.1" ,
4345 "less-loader" : " ^2.2.3" ,
46+ "mocha" : " ^3.2.0" ,
4447 "node-sass" : " ^3.13.0" ,
4548 "react-hot-loader" : " ^3.0.0-beta.6" ,
4649 "react-redux" : " ^4.4.6" ,
Original file line number Diff line number Diff line change 1+ import { assert } from 'chai' ;
2+ import { insertText } from '../src/TextHelper' ;
3+
4+ describe ( "TextHelperSpec.js" , function ( ) {
5+ describe ( 'insertText' , function ( ) {
6+ it ( 'should work mid-string' , function ( ) {
7+ var text = insertText ( 'bob school' , 'went to ' , 4 ) ;
8+ assert . strictEqual ( text , 'bob went to school' ) ;
9+ } ) ;
10+ it ( 'should work in the start' , function ( ) {
11+ var text = insertText ( 'went to school' , 'bob ' , 0 ) ;
12+ assert . strictEqual ( text , 'bob went to school' ) ;
13+ } ) ;
14+ it ( 'should work in the end' , function ( ) {
15+ var text = insertText ( 'bob went to' , ' school' , 11 ) ;
16+ assert . strictEqual ( text , 'bob went to school' ) ;
17+ } ) ;
18+
19+ it ( 'should work with a position greater than the max' , function ( ) {
20+ var text = insertText ( 'bob went to' , ' school' , 20 ) ;
21+ assert . strictEqual ( text , 'bob went to school' ) ;
22+ } ) ;
23+ } )
24+ } ) ;
You can’t perform that action at this time.
0 commit comments