Skip to content

Commit

Permalink
feat(htmleditor): Add runtime tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marker dao ® committed Oct 10, 2024
1 parent 207f455 commit 78de273
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,5 +272,34 @@ testModule('converter option', () => {
assert.ok(true, 'there is no error');
}
});

test('coverter should be replaced in runtime', function(assert) {
const toHtmlFirstStub = sinon.stub();
const fromHtmlFirstStub = sinon.stub();
const toHtmlSecondStub = sinon.stub();
const fromHtmlSecondStub = sinon.stub();

const firstConverter = {
toHtml: toHtmlFirstStub,
fromHtml: fromHtmlFirstStub,
};

const secondConverter = {
toHtml: toHtmlSecondStub,
fromHtml: fromHtmlSecondStub,
};

const instance = $('#htmlEditor').dxHtmlEditor({
converter: firstConverter,
}).dxHtmlEditor('instance');

instance.option('converter', secondConverter);
instance.option('value', 'new value');

assert.strictEqual(toHtmlFirstStub.callCount, 0);
assert.strictEqual(fromHtmlFirstStub.callCount, 0);
assert.strictEqual(toHtmlSecondStub.callCount, 1);
assert.strictEqual(fromHtmlSecondStub.callCount, 1);
});
});
});

0 comments on commit 78de273

Please sign in to comment.