mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
FIX: details fixes with extra formatting
This commit is contained in:
parent
f38347400c
commit
8141e1d9bc
3 changed files with 14 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
const BLOCK_TAGS = ['address', 'article', 'aside', 'audio', 'blockquote', 'canvas', 'dd', 'details',
|
||||
'div', 'dl', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3',
|
||||
'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'iframe', 'noscript', 'ol', 'output',
|
||||
'p', 'pre', 'section', 'table', 'tfoot', 'ul', 'video'];
|
||||
'p', 'pre', 'section', 'table', 'tfoot', 'ul', 'video', 'summary'];
|
||||
|
||||
function splitAtLast(tag, block, next, first) {
|
||||
const endTag = `</${tag}>`;
|
||||
|
@ -34,7 +34,7 @@ export function setup(helper) {
|
|||
}
|
||||
}
|
||||
|
||||
const m = /^<([^>]+)\>/.exec(block);
|
||||
const m = /^\s*<\/?([^>]+)\>/.exec(block);
|
||||
if (m && m[1]) {
|
||||
const tag = m[1].split(/\s/);
|
||||
if (tag && tag[0] && BLOCK_TAGS.indexOf(tag[0]) !== -1) {
|
||||
|
|
|
@ -57,11 +57,11 @@ test("pollOptionsCount", function() {
|
|||
const controller = this.subject();
|
||||
controller.siteSettings = Discourse.SiteSettings;
|
||||
|
||||
controller.set("pollOptions", "1\n2\n")
|
||||
controller.set("pollOptions", "1\n2\n");
|
||||
|
||||
equal(controller.get("pollOptionsCount"), 2, "it should equal 2");
|
||||
|
||||
controller.set("pollOptions", "")
|
||||
controller.set("pollOptions", "");
|
||||
|
||||
equal(controller.get("pollOptionsCount"), 0, "it should equal 0");
|
||||
});
|
||||
|
|
|
@ -696,3 +696,13 @@ test("emoji - emojiSet", () => {
|
|||
{ emojiSet: 'twitter' },
|
||||
`<p><img src="/images/emoji/twitter/smile.png?v=${v}" title=":smile:" class="emoji" alt=":smile:"></p>`);
|
||||
});
|
||||
|
||||
test("details", () => {
|
||||
cooked(`<details><summary>Info</summary>coucou</details>`,
|
||||
`<details><summary>Info</summary>\n\n<p>coucou</p>\n\n</details>`,
|
||||
"manual HTML for details");
|
||||
cooked(` <details><summary>Info</summary>coucou</details>`,
|
||||
`<details><summary>Info</summary>\n\n<p>coucou</p>\n\n</details>`,
|
||||
"manual HTML for details with a space");
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue