diff options
Diffstat (limited to 'spec/frontend/issuable/helpers.js')
-rw-r--r-- | spec/frontend/issuable/helpers.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/frontend/issuable/helpers.js b/spec/frontend/issuable/helpers.js new file mode 100644 index 00000000000..632d69c2c88 --- /dev/null +++ b/spec/frontend/issuable/helpers.js @@ -0,0 +1,18 @@ +export function getSaveableFormChildren(form, exclude = ['input.js-toggle-draft']) { + const children = Array.from(form.children); + const saveable = children.filter((e) => { + const isFiltered = exclude.reduce( + ({ isFiltered: filtered, element }, selector) => { + return { + isFiltered: filtered || element.matches(selector), + element, + }; + }, + { isFiltered: false, element: e }, + ); + + return !isFiltered.isFiltered; + }); + + return saveable; +} |