Sha256: f17fa90d17dd098099a640913e338459c642aef17ff5c0f8bce0e727a7ede559
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
<script> function ready(fn) { if (document.readyState !== 'loading'){ fn(); } else { document.addEventListener('DOMContentLoaded', fn); } } ready(function() { enableKeyboardShortcuts(); }); function enableKeyboardShortcuts() { function keydown(event) { if (event.ctrlKey && event.shiftKey && event.key === 'A') { event.preventDefault(); generateAssertion(); } } document.addEventListener('keydown', keydown, false); function generateAssertion() { var text = selectedText(); if (text.trim().length > 0) { var action = "assert page.has_content?('" + text.replace("'", "\\\'") + "')"; var testingOutput = JSON.parse(sessionStorage.getItem("testingOutput")); var target = ""; var options = ""; testingOutput.push({action: action, target: target, options: options}); sessionStorage.setItem("testingOutput", JSON.stringify(testingOutput)); alert("Generated an assertion for \"" + selectedText() + "\". Type `flush` in the debugger console to add it to your test file."); } } function selectedText() { var text = ""; if (window.getSelection) { text = window.getSelection().toString(); } else if (document.selection && document.selection.type != "Control") { text = document.selection.createRange().text; } return text; } } </script>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
magic_test-0.0.5 | app/views/magic_test/_context_menu.html |