diff --git a/gulpfile.js b/gulpfile.js index dc45aec..3123f36 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -15,7 +15,7 @@ const paths = { }; // Compile sass into CSS & auto-inject into browsers. -function compile () { +function compile() { var sassOptions = { outputStyle: 'expanded', indentType: 'space', @@ -32,7 +32,7 @@ function compile () { } // Watching scss files. -function watch () { +function watch() { gulp.watch([paths.scss.watch], compile); } diff --git a/js/behat-ui.ace-editor.js b/js/behat-ui.ace-editor.js index a300af5..6b5e90b 100644 --- a/js/behat-ui.ace-editor.js +++ b/js/behat-ui.ace-editor.js @@ -16,8 +16,8 @@ editor.setOption("autoScrollEditorIntoView", "always"); editor.setOption("mergeUndoDeltas", "always"); - editor.setOption("hScrollBarAlwaysVisible", true); - editor.setOption("vScrollBarAlwaysVisible", true); + editor.setOption("hScrollBarAlwaysVisible", TRUE); + editor.setOption("vScrollBarAlwaysVisible", TRUE); // Add command to lazy-load keybinding_menu extension. ace.require("ace/ext/keybinding_menu"); @@ -35,7 +35,7 @@ const behat_ui_language_tools = ace.require("ace/ext/language_tools"); editor.setOptions({ - enableBasicAutocompletion: false, + enableBasicAutocompletion: FALSE, }); const behatUICompleter = { @@ -43,11 +43,11 @@ const gList = ["Given", "When", "Then", "And", "But"]; if (prefix.length === 0) { - callback(null, []); + callback(NULL, []); return; } if (!gList.includes(prefix)) { - callback(null, []); + callback(NULL, []); return; } @@ -55,7 +55,7 @@ Drupal.url("admin/config/development/behat-ui/behat-dl-json"), function (behatUiList) { callback( - null, + NULL, behatUiList.map(function (behatUiItem) { return { name: prefix + behatUiItem, @@ -93,7 +93,7 @@ const keyBehatUICompleter = { getCompletions(editor, session, pos, prefix, callback) { callback( - null, + NULL, keyBehatList.map(function (keyBehatUiItem) { return { name: keyBehatUiItem, @@ -110,7 +110,7 @@ ]); editor.setOptions({ - enableBasicAutocompletion: true, + enableBasicAutocompletion: TRUE, }); editor.getSession().on("change", function () { diff --git a/js/behat-ui.new-test.js b/js/behat-ui.new-test.js index f9fc11c..ba5c0f6 100644 --- a/js/behat-ui.new-test.js +++ b/js/behat-ui.new-test.js @@ -29,11 +29,11 @@ let charIndex = 0; const range = document.createRange(); range.setStart(containerEl, 0); - range.collapse(true); + range.collapse(TRUE); const nodeStack = [containerEl]; let node; - let foundStart = false; - let stop = false; + let foundStart = FALSE; + let stop = FALSE; while (!stop && (node = nodeStack.pop())) { if (node.nodeType == 3) { @@ -44,7 +44,7 @@ savedSel.start <= nextCharIndex ) { range.setStart(node, savedSel.start - charIndex); - foundStart = true; + foundStart = TRUE; } if ( foundStart && @@ -52,7 +52,7 @@ savedSel.end <= nextCharIndex ) { range.setEnd(node, savedSel.end - charIndex); - stop = true; + stop = TRUE; } charIndex = nextCharIndex; } else { @@ -84,7 +84,7 @@ restoreSelection = function (containerEl, savedSel) { const textRange = document.body.createTextRange(); textRange.moveToElementText(containerEl); - textRange.collapse(true); + textRange.collapse(TRUE); textRange.moveEnd("character", savedSel.end); textRange.moveStart("character", savedSel.start); textRange.select(); @@ -119,7 +119,7 @@ appendfunction = "after"; selectfunction = "next"; } else { - return false; + return FALSE; } const $current = $(link).closest(".form-wrapper"); @@ -141,7 +141,7 @@ $other.find(".form-select").attr("name", currentselectname); } - return false; + return FALSE; }; }, }; @@ -152,13 +152,13 @@ "#behat-ui-new-steps .form-text:not(.form-rich-processed)", context ).each(function () { - const id = `${$(this).attr("id")}-rich`; + const id = `${$(this).attr("id")} - rich`; const $rich = $( - `
` + ` < div id = "${id}" contenteditable = "true" class = "form-rich step-no-param" / > ` ); const $plain = $(this); const $wrapper = $( - `` + ` < div id = "${id}-wrapper" class = "field-rich-wrapper" / > ` ); $plain.after($rich); @@ -208,7 +208,7 @@ $remove.click(function () { $(this).closest(".form-wrapper").remove(); - return false; + return FALSE; }); }); }, diff --git a/js/behat-ui.run-tests.js b/js/behat-ui.run-tests.js index 942d5cc..a8e3ab9 100644 --- a/js/behat-ui.run-tests.js +++ b/js/behat-ui.run-tests.js @@ -9,7 +9,7 @@ const killProcess = function () { $("#behat-ui-kill", context).click(function () { $.ajax({ - url: `${drupalSettings.path.baseUrl}behat-ui/kill?${parseInt( + url: `${drupalSettings.path.baseUrl}behat - ui / kill ? ${parseInt( Math.random() * 1000000000, 10 )}`, @@ -28,7 +28,7 @@ ); }, }); - return false; + return FALSE; }); }; @@ -37,7 +37,7 @@ const behat_ui_output = $("#behat-ui-output", context); $.ajax({ - url: `${drupalSettings.path.baseUrl}behat-ui/status?${parseInt( + url: `${drupalSettings.path.baseUrl}behat - ui / status ? ${parseInt( Math.random() * 1000000000, 10 )}`, diff --git a/src/Controller/BehatUiController.php b/src/Controller/BehatUiController.php index e2a22a1..2fc91c0 100644 --- a/src/Controller/BehatUiController.php +++ b/src/Controller/BehatUiController.php @@ -341,6 +341,9 @@ class BehatUiController extends ControllerBase { return $formatedBehatSteps; } + /** + * Behat definitions steps Json. + */ public function getDefinitionStepsJson() { $config = $this->configFactory->getEditable('behat_ui.settings'); diff --git a/src/Form/BehatUiNew.php b/src/Form/BehatUiNew.php index 615044f..c29dd80 100644 --- a/src/Form/BehatUiNew.php +++ b/src/Form/BehatUiNew.php @@ -241,7 +241,7 @@ class BehatUiNew extends FormBase { $features_default_value = 'default'; if (count($features_options) > 0) { if (!isset($features_options['default'])) { - $features_default_value = array_key_first(array($features_default_value)); + $features_default_value = array_key_first([$features_default_value]); } } $form['behat_ui_new_scenario']['behat_ui_feature'] = [ @@ -373,6 +373,9 @@ class BehatUiNew extends FormBase { return $features; } + /** + * Get feature. + */ public function getFeature($feature_name = 'default.feature') { $config = $this->configFactory->getEditable('behat_ui.settings');