Skip to content

Commit ed95dc7

Browse files
JustinCCYapchschan
authored andcommitted
VIS-933: add rhtmlwidget-status attribute (#16)
* Test callback * Update compiled files * Add rhtmlwidget-status attribute * wording change
1 parent 98dd88e commit ed95dc7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

theSrc/scripts/widgetdefinition.js

+8
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ const widgetDefinition = {
5858
}
5959

6060
var graphDiv = document.getElementById(el.id);
61+
62+
// Used by Displayr to determine when widget is ready to be snapshot for testing
63+
graphDiv.setAttribute("rhtmlwidget-status", "loading");
6164

6265
// TODO: move the control panel injection strategy inside here...
6366
HTMLWidgets.addPostRenderHandler(function() {
@@ -551,6 +554,11 @@ const widgetDefinition = {
551554
});
552555
}
553556
} // end of selectionChange
557+
558+
graphDiv.on("plotly_afterplot", function() {
559+
// Used by Displayr to determine when widget is ready to be snapshot for testing
560+
graphDiv.setAttribute("rhtmlwidget-status", "ready");
561+
});
554562
} // end of renderValue
555563
}
556564

0 commit comments

Comments
 (0)