Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-highlighter",
"version": "0.4.1",
"version": "0.4.2",
"description": "Highlight select fragments of texts",
"main": "lib/highlighter.js",
"files": [
Expand All @@ -12,10 +12,10 @@
},
"scripts": {
"test": "_mocha",
"coverage": "istanbul cover _mocha -- -R spec",
"coverage": "istanbul cover node_modules/mocha/bin/_mocha -- -R spec",
"check-coverage": "istanbul check-coverage --statement 90 --function 100",
"test-cover": "istanbul cover _mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js --verbose",
"dist": "rm -rf dist/* && ./node_modules/.bin/webpack"
"test-cover": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && mcat coverage/lcov.info | coveralls --verbose",
"dist": "rimraf dist/* && webpack"
},
"repository": {
"type": "git",
Expand All @@ -33,19 +33,21 @@
},
"homepage": "https://github.com/helior/react-highlighter",
"devDependencies": {
"chai": "^3.5.0",
"coveralls": "^2.11.9",
"istanbul": "^0.4.4",
"jsdom": "^9.4.0",
"mocha": "^2.5.3",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"webpack": "^1.13.1"
"chai": "^4.1.2",
"coveralls": "^3.0.0",
"istanbul": "^0.4.5",
"jsdom": "^11.3.0",
"minicat": "^1.0.0",
"mocha": "^4.0.1",
"react": "^15.0.0 || ^16.0.0",
"react-dom": "^15.0.0 || ^16.0.0",
"rimraf": "^2.6.2",
"webpack": "^2.0.0 || ^3.0.0"
},
"dependencies": {
"blacklist": "^1.1.2",
"create-react-class": "^15.5.2",
"blacklist": "^1.1.4",
"create-react-class": "^15.6.2",
"escape-string-regexp": "^1.0.5",
"prop-types": "^15.5.8"
"prop-types": "^15.6.0"
}
}
10 changes: 5 additions & 5 deletions test/testHighlighter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ var ReactDOM = require('react-dom');
var expect = require('chai').expect;
var Highlight = require('..');

global.document = require('jsdom').jsdom();
var jsdom = require('jsdom');
const { JSDOM } = jsdom;

const { document } = (new JSDOM('')).window;
global.document = document;
global.window = global.document.defaultView;

describe('Highlight element', function() {
Expand All @@ -25,7 +29,6 @@ describe('Highlight element', function() {

expect(ReactDOM.findDOMNode(node).children.length).to.equal(3);
expect(matches).to.have.length(1);

});

it('should allow empty search', function() {
Expand All @@ -35,10 +38,8 @@ describe('Highlight element', function() {

expect(ReactDOM.findDOMNode(node).children.length).to.equal(0);
expect(matches).to.have.length(0);

});


it('should support custom HTML tag for matching elements', function() {
var element = React.createElement(Highlight, {search: 'world', matchElement: 'em'}, 'Hello World');
var node = TestUtils.renderIntoDocument(element);
Expand Down Expand Up @@ -90,6 +91,5 @@ describe('Highlight element', function() {
}
var element = React.createElement(Highlight, {search: /([A-Za-z])+/}, longString);
expect(TestUtils.renderIntoDocument.bind(TestUtils, element)).not.to.throw(Error);

});
});
8 changes: 4 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ var pkg = require('./package.json');

module.exports = [
{
entry: './lib/highlighter.js',
entry: (__dirname + '/lib/highlighter.js'),
output: {
path: './dist',
path: (__dirname + '/dist'),
pathinfo: true,
sourcePrefix: '',
filename: 'ReactHighlighter-v' + pkg.version + '.js',
Expand All @@ -17,9 +17,9 @@ module.exports = [
}
},
{
entry: './lib/highlighter.js',
entry: (__dirname + '/lib/highlighter.js'),
output: {
path: './dist',
path: (__dirname + '/dist'),
filename: 'ReactHighlighter-v' + pkg.version + '.min.js',
library: 'ReactHighlighter',
libraryTarget: "umd"
Expand Down