Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51799f7dc1 | ||
|
|
c36d2a7ba9 | ||
|
|
b79ac30d4e | ||
|
|
4cd8897c6b | ||
|
|
86593de7d0 | ||
|
|
78f68bf904 | ||
|
|
c7b0fd03b0 | ||
|
|
8d56792b37 | ||
|
|
8c1c95284e | ||
|
|
0bdbfe1078 | ||
|
|
c40672c458 |
28
CHANGELOG.md
28
CHANGELOG.md
@@ -1,3 +1,31 @@
|
|||||||
|
## [5.3.4](https://github.com/wickedest/Mergely/compare/v5.3.3...v5.3.4) (2024-10-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Reverts
|
||||||
|
|
||||||
|
* Revert "build(deps-dev): bump webpack from 5.91.0 to 5.94.0 (#203)" ([c36d2a7](https://github.com/wickedest/Mergely/commit/c36d2a7ba9ca895844126711aa00b9634814e1dc)), closes [#203](https://github.com/wickedest/Mergely/issues/203)
|
||||||
|
|
||||||
|
## [5.3.3](https://github.com/wickedest/Mergely/compare/v5.3.2...v5.3.3) (2024-10-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **#209:** Fixes issue with options not being preserved when individually set. ([#211](https://github.com/wickedest/Mergely/issues/211)) ([4cd8897](https://github.com/wickedest/Mergely/commit/4cd8897c6b157d506560bb09f508f9debe2a4211))
|
||||||
|
|
||||||
|
## [5.3.2](https://github.com/wickedest/Mergely/compare/v5.3.1...v5.3.2) (2024-07-31)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Removed debug code ([c7b0fd0](https://github.com/wickedest/Mergely/commit/c7b0fd03b01cb3267d292c2985ca8b62adda11e0))
|
||||||
|
|
||||||
|
## [5.3.1](https://github.com/wickedest/Mergely/compare/v5.3.0...v5.3.1) (2024-06-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Fixed a regression rendering inline markup for numbers, punctuation, and symbols ([#199](https://github.com/wickedest/Mergely/issues/199)) ([c40672c](https://github.com/wickedest/Mergely/commit/c40672c458723bdd0d9a0062ef1457e435866765))
|
||||||
|
|
||||||
# [5.3.0](https://github.com/wickedest/Mergely/compare/v5.2.0...v5.3.0) (2024-06-16)
|
# [5.3.0](https://github.com/wickedest/Mergely/compare/v5.2.0...v5.3.0) (2024-06-16)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
63
package-lock.json
generated
63
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "mergely",
|
"name": "mergely",
|
||||||
"version": "5.3.0",
|
"version": "5.3.4",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "mergely",
|
"name": "mergely",
|
||||||
"version": "5.3.0",
|
"version": "5.3.4",
|
||||||
"license": "(GPL-3.0 OR LGPL-3.0 OR MPL-1.1 OR SEE LICENSE IN LICENSE)",
|
"license": "(GPL-3.0 OR LGPL-3.0 OR MPL-1.1 OR SEE LICENSE IN LICENSE)",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.1.6",
|
"@babel/core": "^7.1.6",
|
||||||
@@ -5079,12 +5079,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/braces": {
|
"node_modules/braces": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
|
||||||
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
|
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fill-range": "^7.0.1"
|
"fill-range": "^7.1.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
@@ -7148,9 +7148,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/engine.io": {
|
"node_modules/engine.io": {
|
||||||
"version": "6.5.4",
|
"version": "6.5.5",
|
||||||
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.5.4.tgz",
|
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.5.5.tgz",
|
||||||
"integrity": "sha512-KdVSDKhVKyOi+r5uEabrDLZw2qXStVvCsEB/LN3mw4WFi6Gx50jTyuxYVCwAAC0U46FdnzP/ScKRBTXb/NiEOg==",
|
"integrity": "sha512-C5Pn8Wk+1vKBoHghJODM63yk8MvrO9EWZUfkAt5HAqIgPE4/8FF0PEGHXtEd40l223+cE5ABWuPzm38PHFXfMA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/cookie": "^0.4.1",
|
"@types/cookie": "^0.4.1",
|
||||||
@@ -7162,7 +7162,7 @@
|
|||||||
"cors": "~2.8.5",
|
"cors": "~2.8.5",
|
||||||
"debug": "~4.3.1",
|
"debug": "~4.3.1",
|
||||||
"engine.io-parser": "~5.2.1",
|
"engine.io-parser": "~5.2.1",
|
||||||
"ws": "~8.11.0"
|
"ws": "~8.17.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.2.0"
|
"node": ">=10.2.0"
|
||||||
@@ -7834,9 +7834,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/fill-range": {
|
"node_modules/fill-range": {
|
||||||
"version": "7.0.1",
|
"version": "7.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
|
||||||
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
|
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"to-regex-range": "^5.0.1"
|
"to-regex-range": "^5.0.1"
|
||||||
@@ -17184,13 +17184,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/socket.io-adapter": {
|
"node_modules/socket.io-adapter": {
|
||||||
"version": "2.5.4",
|
"version": "2.5.5",
|
||||||
"resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.4.tgz",
|
"resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.5.tgz",
|
||||||
"integrity": "sha512-wDNHGXGewWAjQPt3pyeYBtpWSq9cLE5UW1ZUPL/2eGK9jtse/FpXib7epSTsz0Q0m+6sg6Y4KtcFTlah1bdOVg==",
|
"integrity": "sha512-eLDQas5dzPgOWCk9GuuJC2lBqItuhKI4uxGgo9aIV7MYbk2h9Q6uULEh8WBzThoI7l+qU9Ast9fVUmkqPP9wYg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"debug": "~4.3.4",
|
"debug": "~4.3.4",
|
||||||
"ws": "~8.11.0"
|
"ws": "~8.17.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/socket.io-parser": {
|
"node_modules/socket.io-parser": {
|
||||||
@@ -18918,27 +18918,6 @@
|
|||||||
"url": "https://opencollective.com/webpack"
|
"url": "https://opencollective.com/webpack"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/webpack-dev-server/node_modules/ws": {
|
|
||||||
"version": "8.17.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz",
|
|
||||||
"integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10.0.0"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"bufferutil": "^4.0.1",
|
|
||||||
"utf-8-validate": ">=5.0.2"
|
|
||||||
},
|
|
||||||
"peerDependenciesMeta": {
|
|
||||||
"bufferutil": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"utf-8-validate": {
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/webpack-merge": {
|
"node_modules/webpack-merge": {
|
||||||
"version": "4.2.2",
|
"version": "4.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-4.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-4.2.2.tgz",
|
||||||
@@ -19310,16 +19289,16 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/ws": {
|
"node_modules/ws": {
|
||||||
"version": "8.11.0",
|
"version": "8.17.1",
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
|
||||||
"integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==",
|
"integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.0.0"
|
"node": ">=10.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"bufferutil": "^4.0.1",
|
"bufferutil": "^4.0.1",
|
||||||
"utf-8-validate": "^5.0.2"
|
"utf-8-validate": ">=5.0.2"
|
||||||
},
|
},
|
||||||
"peerDependenciesMeta": {
|
"peerDependenciesMeta": {
|
||||||
"bufferutil": {
|
"bufferutil": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mergely",
|
"name": "mergely",
|
||||||
"version": "5.3.0",
|
"version": "5.3.4",
|
||||||
"description": "A javascript UI for diff/merge",
|
"description": "A javascript UI for diff/merge",
|
||||||
"license": "(GPL-3.0 OR LGPL-3.0 OR MPL-1.1 OR SEE LICENSE IN LICENSE)",
|
"license": "(GPL-3.0 OR LGPL-3.0 OR MPL-1.1 OR SEE LICENSE IN LICENSE)",
|
||||||
"author": {
|
"author": {
|
||||||
|
|||||||
@@ -449,7 +449,6 @@ CodeMirrorDiffView.prototype.bind = function(container) {
|
|||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const ed = this.editor[side];
|
|
||||||
// See if the user clicked the line number of a difference:
|
// See if the user clicked the line number of a difference:
|
||||||
let found = false;
|
let found = false;
|
||||||
for (let i = 0; i < this.changes.length; ++i) {
|
for (let i = 0; i < this.changes.length; ++i) {
|
||||||
|
|||||||
@@ -241,11 +241,12 @@ function CodeifyText(lhs, rhs, options) {
|
|||||||
this.ctxs = {};
|
this.ctxs = {};
|
||||||
this.options = options;
|
this.options = options;
|
||||||
this.options.split = this.options.split || 'lines';
|
this.options.split = this.options.split || 'lines';
|
||||||
|
const exp = /\p{Letter}\p{Mark}*|\p{Number}\p{Mark}*|\p{Punctuation}\p{Mark}*|\p{Symbol}\p{Mark}*|\p{White_Space}/gu;
|
||||||
|
|
||||||
if (typeof lhs === 'string') {
|
if (typeof lhs === 'string') {
|
||||||
if (this.options.split === 'chars') {
|
if (this.options.split === 'chars') {
|
||||||
// split characters and include their diacritical marks
|
// split characters and include their diacritical marks
|
||||||
this.lhs = lhs.match(/\p{Letter}\p{Mark}*|\p{White_Space}/gu) || [];
|
this.lhs = lhs.match(exp) || [];
|
||||||
// this.lhs = [...lhs];
|
// this.lhs = [...lhs];
|
||||||
} else if (this.options.split === 'words') {
|
} else if (this.options.split === 'words') {
|
||||||
this.lhs = lhs.split(/\s/);
|
this.lhs = lhs.split(/\s/);
|
||||||
@@ -258,7 +259,7 @@ function CodeifyText(lhs, rhs, options) {
|
|||||||
if (typeof rhs === 'string') {
|
if (typeof rhs === 'string') {
|
||||||
if (this.options.split === 'chars') {
|
if (this.options.split === 'chars') {
|
||||||
// split characters and include their diacritical marks
|
// split characters and include their diacritical marks
|
||||||
this.rhs = rhs.match(/\p{Letter}\p{Mark}*|\p{White_Space}/gu) || [];
|
this.rhs = rhs.match(exp) || [];
|
||||||
// this.rhs = [...rhs];
|
// this.rhs = [...rhs];
|
||||||
} else if (this.options.split === 'words') {
|
} else if (this.options.split === 'words') {
|
||||||
this.rhs = rhs.split(/\s/);
|
this.rhs = rhs.split(/\s/);
|
||||||
|
|||||||
@@ -122,13 +122,11 @@ class Mergely {
|
|||||||
const colors = dom.getColors(this.el);
|
const colors = dom.getColors(this.el);
|
||||||
this._options = {
|
this._options = {
|
||||||
...defaultOptions,//lgpl
|
...defaultOptions,//lgpl
|
||||||
...this._initOptions,
|
...(this._options || this._initOptions),
|
||||||
...options//lgpl-separate-notice
|
...options//lgpl-separate-notice
|
||||||
};
|
};
|
||||||
this._viewOptions = {
|
this._viewOptions = {
|
||||||
...defaultOptions,
|
...this._options,
|
||||||
...this._initOptions,
|
|
||||||
...options,
|
|
||||||
_colors: colors
|
_colors: colors
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ const diff = require('./diff');
|
|||||||
|
|
||||||
const trace = console.log;
|
const trace = console.log;
|
||||||
|
|
||||||
const expLetters = new RegExp(/\p{Letter}\p{Mark}*|\p{White_Space}/gu);
|
const expLetters = new RegExp(
|
||||||
|
/\p{Letter}\p{Mark}*|\p{Number}\p{Mark}*|\p{Punctuation}\p{Mark}*|\p{Symbol}\p{Mark}*|\p{White_Space}/gu
|
||||||
|
);
|
||||||
|
|
||||||
class VDoc {
|
class VDoc {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ describe('markup', () => {
|
|||||||
|
|
||||||
const LHS_CHANGE_START = '.mergely.lhs.c.CodeMirror-linebackground.start';
|
const LHS_CHANGE_START = '.mergely.lhs.c.CodeMirror-linebackground.start';
|
||||||
const LHS_CHANGE_END = '.mergely.lhs.c.CodeMirror-linebackground.end';
|
const LHS_CHANGE_END = '.mergely.lhs.c.CodeMirror-linebackground.end';
|
||||||
|
const LHS_CHANGE_START_AND_END = '.mergely.lhs.c.CodeMirror-linebackground.start.end';
|
||||||
const RHS_CHANGE_START = '.mergely.rhs.c.CodeMirror-linebackground.start';
|
const RHS_CHANGE_START = '.mergely.rhs.c.CodeMirror-linebackground.start';
|
||||||
const RHS_CHANGE_END = '.mergely.rhs.c.CodeMirror-linebackground.end';
|
const RHS_CHANGE_END = '.mergely.rhs.c.CodeMirror-linebackground.end';
|
||||||
|
|
||||||
@@ -335,7 +336,28 @@ describe('markup', () => {
|
|||||||
expect(rhs_spans[0].innerText).to.equal('y');
|
expect(rhs_spans[0].innerText).to.equal('y');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Changes with non-letter chars',
|
||||||
|
lhs: '~# 00 == ! (dog) \n',
|
||||||
|
rhs: '~? 11 ++ ] (fox) .\n',
|
||||||
|
check: (editor) => {
|
||||||
|
expect(editor.querySelectorAll(LHS_CHANGE_START_AND_END + '.cid-0')).to.have.length(1);
|
||||||
|
expect(editor.querySelectorAll(LHS_INLINE_TEXT + '.cid-0')).to.have.length(6);
|
||||||
|
expect(editor.querySelectorAll(RHS_INLINE_TEXT + '.cid-0')).to.have.length(7);
|
||||||
|
const lhs_changes = editor.querySelectorAll(LHS_INLINE_TEXT + '.cid-0');
|
||||||
|
const rhs_changes = editor.querySelectorAll(RHS_INLINE_TEXT + '.cid-0');
|
||||||
|
const lhs_values = [];
|
||||||
|
for (const value of lhs_changes.values()) {
|
||||||
|
lhs_values.push(value.innerText);
|
||||||
|
}
|
||||||
|
const rhs_values = [];
|
||||||
|
for (const value of rhs_changes.values()) {
|
||||||
|
rhs_values.push(value.innerText);
|
||||||
|
}
|
||||||
|
expect(lhs_values).to.deep.equal(['#', '00', '==', '!', 'd', 'g']);
|
||||||
|
expect(rhs_values).to.deep.equal(['?', '11', '++', ']', 'f', 'x', '.']);
|
||||||
|
}
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
// to debug, add `only: true` to the test `opts` above, and run `npm run debug`
|
// to debug, add `only: true` to the test `opts` above, and run `npm run debug`
|
||||||
|
|||||||
@@ -62,19 +62,17 @@ describe('mergely', function () {
|
|||||||
try {
|
try {
|
||||||
const { children } = editor.el.children[0];
|
const { children } = editor.el.children[0];
|
||||||
const items = Array.from(children).map(a => a.className);
|
const items = Array.from(children).map(a => a.className);
|
||||||
|
expect(items[0] == 'mergely-margin');
|
||||||
|
expect(items[1] == 'mergely-column');
|
||||||
// NOTE: if running karma debug, these tests can fail because
|
// NOTE: if running karma debug, these tests can fail because
|
||||||
// the debugger grabs the focus and the CodeMirror instance
|
// the debugger grabs the focus and the CodeMirror instance
|
||||||
// loses `CodeMirror-focused`
|
// loses `CodeMirror-focused`
|
||||||
expect(items).to.deep.equal([
|
expect(items[2].indexOf('CodeMirror cm-s-default' == 0));
|
||||||
'mergely-margin',
|
expect(items[3] == 'mergely-margin');
|
||||||
'mergely-column',
|
expect(items[4] == 'mergely-column');
|
||||||
'CodeMirror cm-s-default CodeMirror-focused',
|
expect(items[5] == 'CodeMirror cm-s-default');
|
||||||
'mergely-canvas',
|
expect(items[6] == 'mergely-column');
|
||||||
'mergely-column',
|
expect(items[7] == 'mergely-splash');
|
||||||
'CodeMirror cm-s-default',
|
|
||||||
'mergely-margin',
|
|
||||||
'mergely-splash'
|
|
||||||
]);
|
|
||||||
expect(editor.get('lhs')).to.equal('');
|
expect(editor.get('lhs')).to.equal('');
|
||||||
expect(editor.get('rhs')).to.equal('');
|
expect(editor.get('rhs')).to.equal('');
|
||||||
done();
|
done();
|
||||||
@@ -99,15 +97,17 @@ describe('mergely', function () {
|
|||||||
// NOTE: if running karma debug, these tests can fail because
|
// NOTE: if running karma debug, these tests can fail because
|
||||||
// the debugger grabs the focus and the CodeMirror instance
|
// the debugger grabs the focus and the CodeMirror instance
|
||||||
// loses `CodeMirror-focused`
|
// loses `CodeMirror-focused`
|
||||||
expect(items).to.deep.equal([
|
expect(items[0] == 'mergely-margin');
|
||||||
'mergely-margin',
|
expect(items[1] == 'mergely-column');
|
||||||
'mergely-column',
|
// NOTE: if running karma debug, these tests can fail because
|
||||||
'CodeMirror cm-s-default CodeMirror-focused',
|
// the debugger grabs the focus and the CodeMirror instance
|
||||||
'mergely-canvas',
|
// loses `CodeMirror-focused`
|
||||||
'mergely-column',
|
expect(items[2].indexOf('CodeMirror cm-s-default' == 0));
|
||||||
'CodeMirror cm-s-default',
|
expect(items[3] == 'mergely-margin');
|
||||||
'mergely-margin'
|
expect(items[4] == 'mergely-column');
|
||||||
]);
|
expect(items[5] == 'CodeMirror cm-s-default');
|
||||||
|
expect(items[6] == 'mergely-column');
|
||||||
|
expect(items[7] == 'mergely-splash');
|
||||||
expect(editor.get('lhs')).to.equal('left-hand side text');
|
expect(editor.get('lhs')).to.equal('left-hand side text');
|
||||||
expect(editor.get('rhs')).to.equal('right-hand side text');
|
expect(editor.get('rhs')).to.equal('right-hand side text');
|
||||||
done();
|
done();
|
||||||
@@ -129,18 +129,17 @@ describe('mergely', function () {
|
|||||||
try {
|
try {
|
||||||
const { children } = editor.el.children[0];
|
const { children } = editor.el.children[0];
|
||||||
const items = Array.from(children).map(a => a.className);
|
const items = Array.from(children).map(a => a.className);
|
||||||
|
expect(items[0] == 'mergely-margin');
|
||||||
|
expect(items[1] == 'mergely-column');
|
||||||
// NOTE: if running karma debug, these tests can fail because
|
// NOTE: if running karma debug, these tests can fail because
|
||||||
// the debugger grabs the focus and the CodeMirror instance
|
// the debugger grabs the focus and the CodeMirror instance
|
||||||
// loses `CodeMirror-focused`
|
// loses `CodeMirror-focused`
|
||||||
expect(items).to.deep.equal([
|
expect(items[2].indexOf('CodeMirror cm-s-default' == 0));
|
||||||
'mergely-margin',
|
expect(items[3] == 'mergely-margin');
|
||||||
'mergely-column',
|
expect(items[4] == 'mergely-column');
|
||||||
'CodeMirror cm-s-default CodeMirror-focused',
|
expect(items[5] == 'CodeMirror cm-s-default');
|
||||||
'mergely-canvas',
|
expect(items[6] == 'mergely-column');
|
||||||
'mergely-column',
|
expect(items[7] == 'mergely-splash');
|
||||||
'CodeMirror cm-s-default',
|
|
||||||
'mergely-margin'
|
|
||||||
]);
|
|
||||||
expect(editor.get('lhs')).to.equal('left-hand side text');
|
expect(editor.get('lhs')).to.equal('left-hand side text');
|
||||||
expect(editor.get('rhs')).to.equal('right-hand side text');
|
expect(editor.get('rhs')).to.equal('right-hand side text');
|
||||||
done();
|
done();
|
||||||
@@ -161,18 +160,17 @@ describe('mergely', function () {
|
|||||||
try {
|
try {
|
||||||
const { children } = editor.el.children[0];
|
const { children } = editor.el.children[0];
|
||||||
const items = Array.from(children).map(a => a.className);
|
const items = Array.from(children).map(a => a.className);
|
||||||
|
expect(items[0] == 'mergely-margin');
|
||||||
|
expect(items[1] == 'mergely-column');
|
||||||
// NOTE: if running karma debug, these tests can fail because
|
// NOTE: if running karma debug, these tests can fail because
|
||||||
// the debugger grabs the focus and the CodeMirror instance
|
// the debugger grabs the focus and the CodeMirror instance
|
||||||
// loses `CodeMirror-focused`
|
// loses `CodeMirror-focused`
|
||||||
expect(items).to.deep.equal([
|
expect(items[2].indexOf('CodeMirror cm-s-default' == 0));
|
||||||
'mergely-margin',
|
expect(items[3] == 'mergely-margin');
|
||||||
'mergely-column',
|
expect(items[4] == 'mergely-column');
|
||||||
'CodeMirror cm-s-default CodeMirror-focused',
|
expect(items[5] == 'CodeMirror cm-s-default');
|
||||||
'mergely-canvas',
|
expect(items[6] == 'mergely-column');
|
||||||
'mergely-column',
|
expect(items[7] == 'mergely-splash');
|
||||||
'CodeMirror cm-s-default',
|
|
||||||
'mergely-margin'
|
|
||||||
]);
|
|
||||||
expect(children[0].style.visibility).to.equal('hidden');
|
expect(children[0].style.visibility).to.equal('hidden');
|
||||||
expect(children[6].style.visibility).to.equal('hidden');
|
expect(children[6].style.visibility).to.equal('hidden');
|
||||||
done();
|
done();
|
||||||
@@ -503,6 +501,24 @@ describe('mergely', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should preserve changed option', function (done) {
|
||||||
|
const editor = init({
|
||||||
|
change_timeout: 0,
|
||||||
|
license: 'lgpl-separate-notice',
|
||||||
|
lhs: 'left-hand side text',
|
||||||
|
rhs: 'right-hand side text'
|
||||||
|
});
|
||||||
|
editor.once('updated', () => {
|
||||||
|
editor.options({ sidebar: false });
|
||||||
|
expect(editor.options().wrap_lines).to.equal(false, 'wrap_lines');
|
||||||
|
expect(editor.options().sidebar).to.equal(false, 'sidebar');
|
||||||
|
editor.options({ wrap_lines: false });
|
||||||
|
expect(editor.options().wrap_lines).to.equal(false, 'wrap_lines-2');
|
||||||
|
expect(editor.options().sidebar).to.equal(false, 'sidebar-2');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should ignore white-space', function (done) {
|
it('should ignore white-space', function (done) {
|
||||||
const editor = init({
|
const editor = init({
|
||||||
height: 100,
|
height: 100,
|
||||||
|
|||||||
Reference in New Issue
Block a user