diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /devtools/client/shadereditor/test/browser_se_editors-error-tooltip.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/shadereditor/test/browser_se_editors-error-tooltip.js')
-rw-r--r-- | devtools/client/shadereditor/test/browser_se_editors-error-tooltip.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/devtools/client/shadereditor/test/browser_se_editors-error-tooltip.js b/devtools/client/shadereditor/test/browser_se_editors-error-tooltip.js new file mode 100644 index 000000000..1ce31bebf --- /dev/null +++ b/devtools/client/shadereditor/test/browser_se_editors-error-tooltip.js @@ -0,0 +1,56 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Tests if error tooltips can be opened from the editor's gutter when there's + * a shader compilation error. + */ + +function* ifWebGLSupported() { + let { target, panel } = yield initShaderEditor(SIMPLE_CANVAS_URL); + let { gFront, EVENTS, ShadersEditorsView } = panel.panelWin; + + reload(target); + yield promise.all([ + once(gFront, "program-linked"), + once(panel.panelWin, EVENTS.SOURCES_SHOWN) + ]); + + let vsEditor = yield ShadersEditorsView._getEditor("vs"); + let fsEditor = yield ShadersEditorsView._getEditor("fs"); + + vsEditor.replaceText("vec3", { line: 7, ch: 22 }, { line: 7, ch: 26 }); + yield once(panel.panelWin, EVENTS.SHADER_COMPILED); + + // Synthesizing 'mouseover' events doesn't work, hack around this by + // manually calling the event listener with the expected arguments. + let editorDocument = vsEditor.container.contentDocument; + let marker = editorDocument.querySelector(".error"); + let parsed = ShadersEditorsView._errors.vs[0].messages; + ShadersEditorsView._onMarkerMouseOver(7, marker, parsed); + + let tooltip = marker._markerErrorsTooltip; + ok(tooltip, "A tooltip was created successfully."); + + let content = tooltip.content; + ok(tooltip.content, + "Some tooltip's content was set."); + ok(tooltip.content.className.includes("devtools-tooltip-simple-text-container"), + "The tooltip's content container was created correctly."); + + let messages = content.childNodes; + is(messages.length, 2, + "There are two messages displayed in the tooltip."); + ok(messages[0].className.includes("devtools-tooltip-simple-text"), + "The first message was created correctly."); + ok(messages[1].className.includes("devtools-tooltip-simple-text"), + "The second message was created correctly."); + + ok(messages[0].textContent.includes("'constructor' : too many arguments"), + "The first message contains the correct text."); + ok(messages[1].textContent.includes("'assign' : cannot convert"), + "The second message contains the correct text."); + + yield teardown(panel); + finish(); +} |