changed document.querySelector... to this.view.query...

pull/3094/head
LianaHus 6 years ago
parent 17e45610eb
commit 20f2c166de
  1. 4
      src/app/staticanalysis/staticAnalysisView.js
  2. 10
      src/app/tabs/test-tab.js

@ -136,8 +136,8 @@ staticAnalysisView.prototype.run = function () {
} }
staticAnalysisView.prototype.checkModule = function (event) { staticAnalysisView.prototype.checkModule = function (event) {
let selected = document.querySelectorAll('[name="staticanalysismodule"]:checked') let selected = this.view.querySelectorAll('[name="staticanalysismodule"]:checked')
let checkAll = document.querySelector('[id="checkAllEntries"]') let checkAll = this.view.querySelector('[id="checkAllEntries"]')
if (event.target.checked) { if (event.target.checked) {
checkAll.checked = true checkAll.checked = true
} else if (!selected.length) { } else if (!selected.length) {

@ -100,7 +100,7 @@ module.exports = class TestTab {
} }
self._deps.filePanel.event.register('newTestFileCreated', file => { self._deps.filePanel.event.register('newTestFileCreated', file => {
var testList = document.querySelector("[class^='testList']") var testList = self.view.querySelector("[class^='testList']")
var test = yo`<label class="singleTestLabel"><input class="singleTest" onchange=${(e) => toggleCheckbox(e.target.checked, file)} type="checkbox" checked="true">${file}</label>` var test = yo`<label class="singleTestLabel"><input class="singleTest" onchange=${(e) => toggleCheckbox(e.target.checked, file)} type="checkbox" checked="true">${file}</label>`
testList.appendChild(test) testList.appendChild(test)
self.data.allTests.push(file) self.data.allTests.push(file)
@ -138,12 +138,12 @@ module.exports = class TestTab {
function toggleCheckbox (eChecked, test) { function toggleCheckbox (eChecked, test) {
if (!self.data.selectedTests) { if (!self.data.selectedTests) {
self.data.selectedTests = document.querySelectorAll('.singleTest:checked') self.data.selectedTests = self._view.el.querySelectorAll('.singleTest:checked')
} }
let selectedTests = self.data.selectedTests let selectedTests = self.data.selectedTests
selectedTests = eChecked ? [...selectedTests, test] : selectedTests.filter(el => el !== test) selectedTests = eChecked ? [...selectedTests, test] : selectedTests.filter(el => el !== test)
self.data.selectedTests = selectedTests self.data.selectedTests = selectedTests
let checkAll = document.querySelector('[id="checkAllTests"]') let checkAll = self._view.el.querySelector('[id="checkAllTests"]')
if (eChecked) { if (eChecked) {
checkAll.checked = true checkAll.checked = true
} else if (!selectedTests.length) { } else if (!selectedTests.length) {
@ -152,8 +152,8 @@ module.exports = class TestTab {
} }
function checkAll (event) { function checkAll (event) {
let checkBoxes = document.querySelectorAll('.singleTest') let checkBoxes = self._view.el.querySelectorAll('.singleTest')
const checkboxesLabels = document.querySelectorAll('.singleTestLabel') const checkboxesLabels = self._view.el.querySelectorAll('.singleTestLabel')
// checks/unchecks all // checks/unchecks all
for (let i = 0; i < checkBoxes.length; i++) { for (let i = 0; i < checkBoxes.length; i++) {
checkBoxes[i].checked = event.target.checked checkBoxes[i].checked = event.target.checked

Loading…
Cancel
Save