Debian Codegraph @

extensions/VisualEditor/lib/ve/tests/dm/ve.dm.Annotation.test.js

raw symbols SCIP
1 /*!
2 * VisualEditor DataModel Annotation tests.
3 *
4 * @copyright See AUTHORS.txt
5 */
6
7 QUnit.module( 've.dm.Annotation' );
8
9 QUnit.test( 'getHashObject', ( assert ) => {
10 const cases = [
11 {
12 msg: 'Bold',
13 annotation: new ve.dm.BoldAnnotation( {
14 type: 'textStyle/bold',
15 attributes: { nodeName: 'b' }
16 } ),
17 expected: {
18 type: 'textStyle/bold',
19 attributes: { nodeName: 'b' }
20 }
21 },
22 {
23 msg: 'Italic with original DOM elements',
24 annotation: new ve.dm.ItalicAnnotation( {
25 type: 'textStyle/italic',
26 attributes: { nodeName: 'i' },
27 originalDomElementsHash: 1
28 } ),
29 expected: {
30 type: 'textStyle/italic',
31 attributes: { nodeName: 'i' },
32 originalDomElementsHash: 1
33 }
34 }
35 ];
36
37 cases.forEach( ( caseItem ) => {
38 assert.deepEqual( caseItem.annotation.getHashObject(), caseItem.expected, caseItem.msg );
39 } );
40 } );