mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-28 02:00:57 +00:00
Merge "Fix inserting replies inside a <pre>"
This commit is contained in:
commit
5fdf6ae466
|
@ -194,6 +194,8 @@
|
||||||
"cases/split-list/split-list-modified.html",
|
"cases/split-list/split-list-modified.html",
|
||||||
"cases/split-list2/split-list2.html",
|
"cases/split-list2/split-list2.html",
|
||||||
"cases/split-list2/split-list2-modified.html",
|
"cases/split-list2/split-list2-modified.html",
|
||||||
|
"cases/wrappers/wrappers.html",
|
||||||
|
"cases/wrappers/wrappers-modified.html",
|
||||||
"cases/signatures-funny/signatures-funny.html",
|
"cases/signatures-funny/signatures-funny.html",
|
||||||
"cases/signatures-funny/signatures-funny-modified.html",
|
"cases/signatures-funny/signatures-funny-modified.html",
|
||||||
"cases/signatures-funny/signatures-funny-reply.html"
|
"cases/signatures-funny/signatures-funny-reply.html"
|
||||||
|
|
|
@ -94,7 +94,7 @@ function addListItem( comment ) {
|
||||||
|
|
||||||
// If we can't insert a list directly inside this element, insert after it.
|
// If we can't insert a list directly inside this element, insert after it.
|
||||||
// TODO Improve this check
|
// TODO Improve this check
|
||||||
if ( parent.tagName.toLowerCase() === 'p' ) {
|
if ( parent.tagName.toLowerCase() === 'p' || parent.tagName.toLowerCase() === 'pre' ) {
|
||||||
parent = parent.parentNode;
|
parent = parent.parentNode;
|
||||||
target = target.parentNode;
|
target = target.parentNode;
|
||||||
}
|
}
|
||||||
|
|
11
tests/qunit/cases/wrappers/wrappers-modified.html
Normal file
11
tests/qunit/cases/wrappers/wrappers-modified.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<h2>paragraph (outside)</h2>
|
||||||
|
<p>blah blah <b><a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> | <a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a></b> 23:19, 22 January 2020 (UTC)</p><dl><dd data-parsoid="{}">Reply to Matma Rex|2020-01-22T23:19:00.000Z|0</dd></dl>
|
||||||
|
|
||||||
|
<h2>preformatted (outside)</h2>
|
||||||
|
<pre>blah blah <b><a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> | <a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a></b> 23:19, 22 January 2020 (UTC)</pre><dl><dd data-parsoid="{}">Reply to Matma Rex|2020-01-22T23:19:00.000Z|1</dd></dl>
|
||||||
|
|
||||||
|
<h2>div (inside)</h2>
|
||||||
|
<div>blah blah <b><a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> | <a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a></b> 23:19, 22 January 2020 (UTC)<dl><dd data-parsoid="{}">Reply to Matma Rex|2020-01-22T23:19:00.000Z|2</dd></dl></div>
|
||||||
|
|
||||||
|
<h2>table (inside)</h2>
|
||||||
|
<table><tbody><tr><td>blah blah <b><a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> | <a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a></b> 23:19, 22 January 2020 (UTC)<dl><dd data-parsoid="{}">Reply to Matma Rex|2020-01-22T23:19:00.000Z|3</dd></dl></td></tr></tbody></table>
|
11
tests/qunit/cases/wrappers/wrappers.html
Normal file
11
tests/qunit/cases/wrappers/wrappers.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<h2>paragraph (outside)</h2>
|
||||||
|
<p>blah blah <b><a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> | <a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a></b> 23:19, 22 January 2020 (UTC)</p>
|
||||||
|
|
||||||
|
<h2>preformatted (outside)</h2>
|
||||||
|
<pre>blah blah <b><a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> | <a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a></b> 23:19, 22 January 2020 (UTC)</pre>
|
||||||
|
|
||||||
|
<h2>div (inside)</h2>
|
||||||
|
<div>blah blah <b><a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> | <a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a></b> 23:19, 22 January 2020 (UTC)</div>
|
||||||
|
|
||||||
|
<h2>table (inside)</h2>
|
||||||
|
<table><tr><td>blah blah <b><a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> | <a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a></b> 23:19, 22 January 2020 (UTC)</td></tr></table>
|
|
@ -67,6 +67,13 @@ QUnit.test( '#addListItem/#removeListItem', function ( assert ) {
|
||||||
config: require( './data/enwiki-config.json' ),
|
config: require( './data/enwiki-config.json' ),
|
||||||
data: require( './data/enwiki-data.json' )
|
data: require( './data/enwiki-data.json' )
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Reply inserted inside/outside various wrapper elements',
|
||||||
|
dom: mw.template.get( 'test.DiscussionTools', 'cases/wrappers/wrappers.html' ).render(),
|
||||||
|
expected: mw.template.get( 'test.DiscussionTools', 'cases/wrappers/wrappers-modified.html' ).render(),
|
||||||
|
config: require( './data/enwiki-config.json' ),
|
||||||
|
data: require( './data/enwiki-data.json' )
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Signatures in funny places',
|
name: 'Signatures in funny places',
|
||||||
dom: mw.template.get( 'test.DiscussionTools', 'cases/signatures-funny/signatures-funny.html' ).render(),
|
dom: mw.template.get( 'test.DiscussionTools', 'cases/signatures-funny/signatures-funny.html' ).render(),
|
||||||
|
|
Loading…
Reference in a new issue