Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4057894
ve.ce.ContentBranchNode.test.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
ve.ce.ContentBranchNode.test.js
View Options
/*!
* VisualEditor MediaWiki-specific ContentEditable ContentBranchNode tests.
*
* @copyright See AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
QUnit
.
module
(
've.ce.ContentBranchNode (MW)'
);
/* Tests */
// FIXME runner copypasted from core, use data provider
QUnit
.
test
.
each
(
'getRenderedContents'
,
{
'Annotation spanning text and inline nodes'
:
{
data
:
[
{
type
:
'paragraph'
},
'a'
,
[
'b'
,
[
{
type
:
'textStyle/bold'
}
]
],
{
type
:
'mwEntity'
,
attributes
:
{
character
:
'c'
},
annotations
:
[
{
type
:
'textStyle/bold'
}
]
},
{
type
:
'/mwEntity'
},
[
'd'
,
[
{
type
:
'textStyle/bold'
}
]
],
{
type
:
'alienInline'
,
originalDomElements
:
$
.
parseHTML
(
'<span rel="ve:Alien">e</span>'
),
annotations
:
[
{
type
:
'textStyle/bold'
}
]
},
{
type
:
'/alienInline'
},
{
type
:
'/paragraph'
}
],
html
:
ve
.
dm
.
example
.
singleLine
`
a
<b>
b
<span class="ve-ce-leafNode ve-ce-mwEntityNode" contenteditable="false">c</span>
d
<span rel="ve:Alien" class="ve-ce-focusableNode ve-ce-leafNode" contenteditable="false">e</span>
</b>
`
}
},
(
assert
,
{
data
,
html
}
)
=>
{
const
doc
=
new
ve
.
dm
.
Document
(
ve
.
dm
.
example
.
preprocessAnnotations
(
data
)
);
const
$wrapper
=
$
(
new
ve
.
ce
.
ParagraphNode
(
doc
.
getDocumentNode
().
getChildren
()[
0
]
).
getRenderedContents
()
);
// HACK strip out all the class="ve-ce-textStyleAnnotation ve-ce-textStyleBoldAnnotation" crap
$wrapper
.
find
(
'.ve-ce-textStyleAnnotation'
).
removeAttr
(
'class'
);
assert
.
equalDomElement
(
$wrapper
[
0
],
$
(
'<div>'
).
html
(
html
)[
0
]
);
}
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Aug 16 2026, 04:23 (13 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
78/51/8a1d698e4b3e7a00ce753f918011
Default Alt Text
ve.ce.ContentBranchNode.test.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment