Skip to content

Commit ed6ce48

Browse files
author
Ruslan Farkhutdinov
committed
HtmlEditor: Rename isStringInsert & restore mock in tests
1 parent a9f3364 commit ed6ce48

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

packages/devextreme/js/__internal/ui/html_editor/matchers/m_wordLists.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ function removeNewLineChar(operations) {
2121
newLineOperation.insert = newLineOperation.insert.trim();
2222
}
2323

24-
function isTextOp(op): boolean {
25-
return typeof op === 'string';
24+
function isStringInsert(insert: unknown): boolean {
25+
return typeof insert === 'string';
2626
}
2727

2828
const getMatcher = (quill) => {
@@ -34,7 +34,7 @@ const getMatcher = (quill) => {
3434

3535
const insertOperation = ops[0];
3636

37-
if (!isTextOp(insertOperation.insert)) {
37+
if (!isStringInsert(insertOperation.insert)) {
3838
return delta;
3939
}
4040

packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/multilineIntegration.tests.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,24 @@ export default function() {
7171
const spy = sinon.spy(console, 'error');
7272
const value = `<p class="${className}"><br><br></p>`;
7373
const $element = $('#htmlEditor');
74-
$element.dxHtmlEditor({
75-
value
76-
}).dxHtmlEditor('instance');
7774

78-
assert.strictEqual(spy.called, false, 'No console error was thrown');
79-
spy.restore();
75+
try {
76+
$element.dxHtmlEditor({ value }).dxHtmlEditor('instance');
77+
78+
assert.strictEqual(spy.called, false, 'No console error was thrown');
79+
} finally {
80+
spy.restore();
81+
}
8082
});
8183

8284
test(`editor should preserve double <br> in list paragraph for ${className} class (T1292587)`, function(assert) {
8385
const value = `<p class="${className}"><br><br></p>`;
8486
const $element = $('#htmlEditor');
85-
$element.dxHtmlEditor({
87+
const htmlEditor = $element.dxHtmlEditor({
8688
value
8789
}).dxHtmlEditor('instance');
88-
const markup = $element.find(`.${CONTENT_CLASS}`).html();
90+
91+
const markup = htmlEditor.option('value');
8992
const $markup = $('<div>').html(markup);
9093

9194
assert.strictEqual($markup.find('br').length, 2, 'Two soft breaks preserved');

0 commit comments

Comments
 (0)