mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-05-01 11:06:58 +00:00
Fix Entity widget not rendering its content without a refresh (#4776)
* Expose TEXT_NODE and ELEMENT_NODE constants * Add failing test for initial rendering of entity widget * Compute attributes when rendering
This commit is contained in:
@@ -273,6 +273,24 @@ describe("Widget module", function() {
|
||||
expect(wrapper.innerHTML).toBe("<p><a href=\"data:text/vnd.tiddlywiki,Jolly%20Old%20World\">My linky link</a></p>");
|
||||
});
|
||||
|
||||
/* This test reproduces issue #4693. */
|
||||
it("should render the entity widget", function() {
|
||||
var wiki = new $tw.Wiki();
|
||||
// Construct the widget node
|
||||
var text = "\n\n<$entity entity=' ' />\n\n<$entity entity='✓' />\n";
|
||||
var widgetNode = createWidgetNode(parseText(text,wiki),wiki);
|
||||
// Render the widget node to the DOM
|
||||
var wrapper = renderWidgetNode(widgetNode);
|
||||
// Test the rendering
|
||||
expect(wrapper.innerHTML).toBe(" ✓");
|
||||
// Test the sequence numbers in the DOM
|
||||
expect(wrapper.sequenceNumber).toBe(0);
|
||||
expect(wrapper.children[0].sequenceNumber).toBe(1);
|
||||
expect(wrapper.children[0].nodeType).toBe(wrapper.children[0].TEXT_NODE);
|
||||
expect(wrapper.children[1].sequenceNumber).toBe(2);
|
||||
expect(wrapper.children[1].nodeType).toBe(wrapper.children[1].TEXT_NODE);
|
||||
});
|
||||
|
||||
it("should deal with the list widget", function() {
|
||||
var wiki = new $tw.Wiki();
|
||||
// Add some tiddlers
|
||||
|
||||
Reference in New Issue
Block a user