From 45da22c19cf99b25bfc42d1bf144a223f0105ed9 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Tue, 13 Nov 2018 16:32:18 +0100 Subject: [PATCH 01/10] added check/uncheck all to testing tab --- src/app/tabs/styles/test-tab-styles.js | 7 +++++- src/app/tabs/test-tab.js | 30 +++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/app/tabs/styles/test-tab-styles.js b/src/app/tabs/styles/test-tab-styles.js index cc79dc8f18..7a3c663a79 100644 --- a/src/app/tabs/styles/test-tab-styles.js +++ b/src/app/tabs/styles/test-tab-styles.js @@ -45,6 +45,8 @@ var css = csjs` .buttons { ${styles.rightPanel.testTab.box_listTests}; margin: 2%; + display: flex; + align-items: center; } .runButton { ${styles.rightPanel.testTab.button_runTests}; @@ -58,6 +60,9 @@ var css = csjs` font-weight: bold; margin-bottom: 1em; } + .label { + display: flex; + align-items: center; + } ` - module.exports = css diff --git a/src/app/tabs/test-tab.js b/src/app/tabs/test-tab.js index bb85ba84a2..7aab707694 100644 --- a/src/app/tabs/test-tab.js +++ b/src/app/tabs/test-tab.js @@ -101,7 +101,7 @@ module.exports = class TestTab { self._deps.filePanel.event.register('newTestFileCreated', file => { var testList = document.querySelector("[class^='testList']") - var test = yo`` + var test = yo`` testList.appendChild(test) self.data.allTests.push(file) self.data.selectedTests.push(file) @@ -133,13 +133,29 @@ module.exports = class TestTab { function listTests () { var tests = self.data.allTests - return tests.map(test => yo``) + return tests.map(test => yo``) } function toggleCheckbox (e, test) { var selectedTests = self.data.selectedTests selectedTests = e.target.checked ? [...selectedTests, test] : selectedTests.filter(el => el !== test) self.data.selectedTests = selectedTests + var selectAll = document.querySelector('[id="checkAllTests"]') + if (e.target.checked) { + selectAll.checked = true + } + } + + function checkAll (event) { + var all = self.testList.children + + var checkBoxes = document.querySelectorAll('input.singleTest') + var isAnySelected = document.querySelectorAll('input.singleTest:checked').length != 0 + // checks/unchecks all + checkBoxes.forEach (function(checkBox) { + checkBox.checked = !isAnySelected + }) + event.target.checked = !isAnySelected } var runTests = function () { @@ -182,7 +198,15 @@ module.exports = class TestTab {
${self.testList}
-
Run Tests
+
Run Tests
+
${testsOutput} ${testsSummary} From 1b3c35788e8b7802fb8cd66a4a719053e3ad6b3e Mon Sep 17 00:00:00 2001 From: LianaHus Date: Wed, 21 Nov 2018 18:32:23 +0100 Subject: [PATCH 02/10] fixes syntax errors --- src/app/staticanalysis/staticAnalysisView.js | 16 +++++++--------- src/app/tabs/test-tab.js | 10 ++++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/app/staticanalysis/staticAnalysisView.js b/src/app/staticanalysis/staticAnalysisView.js index 8e5abef71a..3af5c3a858 100644 --- a/src/app/staticanalysis/staticAnalysisView.js +++ b/src/app/staticanalysis/staticAnalysisView.js @@ -139,14 +139,9 @@ staticAnalysisView.prototype.checkAll = function (event) { if (!this.view) { return } - var all = this.view.querySelectorAll('[name="staticanalysismodule"]') - var isAnySelected = false - for (var i = 0; i < all.length; i++) { - if (all[i].checked === true) { - isAnySelected = true - break - } - } + var all = this.view.querySelectorAll('[id="staticanalysismodule]"') + var isAnySelected = this.view.querySelectorAll('[id="staticanalysismodule]":checked').length !== 0; + for (var j = 0; j < all.length; j++) { all[j].checked = !isAnySelected } @@ -154,9 +149,12 @@ staticAnalysisView.prototype.checkAll = function (event) { } staticAnalysisView.prototype.checkModule = function (event) { - var selectAll = this.view.querySelector('[id="checkallstaticanalysis" ]') + var selectAll = this.view.querySelector('[id="checkallstaticanalysis"]') + var selected = this.view.querySelectorAll('[id="staticanalysismodule]":checked') if (event.target.checked) { selectAll.checked = true + } else if (selected.length === 0) { + selectAll.checked = false } } diff --git a/src/app/tabs/test-tab.js b/src/app/tabs/test-tab.js index 7aab707694..e8ff527357 100644 --- a/src/app/tabs/test-tab.js +++ b/src/app/tabs/test-tab.js @@ -144,15 +144,17 @@ module.exports = class TestTab { if (e.target.checked) { selectAll.checked = true } + if (selectedTests.length === 0) { + selectAll.checked = false + } + } function checkAll (event) { - var all = self.testList.children - var checkBoxes = document.querySelectorAll('input.singleTest') - var isAnySelected = document.querySelectorAll('input.singleTest:checked').length != 0 + var isAnySelected = document.querySelectorAll('input.singleTest:checked').length !== 0 // checks/unchecks all - checkBoxes.forEach (function(checkBox) { + checkBoxes.forEach(function (checkBox) { checkBox.checked = !isAnySelected }) event.target.checked = !isAnySelected From b5660d263fc56d6b465f84ed4f2a9c18694c2c85 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Sun, 25 Nov 2018 21:42:37 +0100 Subject: [PATCH 03/10] check all for tests --- src/app/staticanalysis/staticAnalysisView.js | 39 ++++++++++---------- src/app/tabs/test-tab.js | 29 +++++++-------- 2 files changed, 32 insertions(+), 36 deletions(-) diff --git a/src/app/staticanalysis/staticAnalysisView.js b/src/app/staticanalysis/staticAnalysisView.js index 3af5c3a858..7c8d9a8fb6 100644 --- a/src/app/staticanalysis/staticAnalysisView.js +++ b/src/app/staticanalysis/staticAnalysisView.js @@ -50,7 +50,7 @@ staticAnalysisView.prototype.render = function () { ${this.modulesView}
- + -
${self.testList} -
-
Run Tests
+
+
Run Tests
-