This repository has been archived by the owner on Oct 24, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REFACTOR: rework of most of client side logic (#24)
- updates markdown-it-footnote lib from 3.0.1 to 3.0.3 - fixes a handful of bugs related to the arrow - ensures footnote separator is not taking height in the post - simplify code - adds a test - get rid of es6
- Loading branch information
Showing
6 changed files
with
156 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers"; | ||
import { click, visit } from "@ember/test-helpers"; | ||
import { test } from "qunit"; | ||
import topicFixtures from "discourse/tests/fixtures/topic"; | ||
import { cloneJSON } from "discourse-common/lib/object"; | ||
|
||
acceptance("Discourse Foonote Plugin", function (needs) { | ||
needs.user(); | ||
|
||
needs.settings({ | ||
display_footnotes_inline: true, | ||
}); | ||
|
||
needs.pretender((server, helper) => { | ||
server.get("/t/45.json", () => { | ||
let topic = cloneJSON(topicFixtures["/t/28830/1.json"]); | ||
topic["post_stream"]["posts"][0]["cooked"] = ` | ||
<p>Lorem ipsum dolor sit amet<sup class="footnote-ref"><a href="#footnote-17-1" id="footnote-ref-17-1">[1]</a></sup></p> | ||
<hr class="footnotes-sep"> | ||
<ol class="footnotes-list"> | ||
<li id="footnote-17-1" class="footnote-item"> | ||
<p>consectetur adipiscing elit <a href="#footnote-ref-17-1" class="footnote-backref">↩︎</a></p> | ||
</li> | ||
</ol> | ||
`; | ||
return helper.response(topic); | ||
}); | ||
}); | ||
|
||
test("displays the foonote on click", async function (assert) { | ||
await visit("/t/45"); | ||
|
||
const tooltip = document.getElementById("footnote-tooltip"); | ||
assert.ok(exists(tooltip)); | ||
|
||
await click(".expand-footnote"); | ||
|
||
const tooltipContent = tooltip.querySelector(".footnote-tooltip-content") | ||
.innerText; | ||
assert.equal(tooltipContent, "consectetur adipiscing elit"); | ||
}); | ||
}); |