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

pull/1/head
LianaHus 6 years ago
parent e71e41819b
commit a5f4758f43
  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) {
let selected = document.querySelectorAll('[name="staticanalysismodule"]:checked')
let checkAll = document.querySelector('[id="checkAllEntries"]')
let selected = this.view.querySelectorAll('[name="staticanalysismodule"]:checked')
let checkAll = this.view.querySelector('[id="checkAllEntries"]')
if (event.target.checked) {
checkAll.checked = true
} else if (!selected.length) {

@ -100,7 +100,7 @@ module.exports = class TestTab {
}
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>`
testList.appendChild(test)
self.data.allTests.push(file)
@ -138,12 +138,12 @@ module.exports = class TestTab {
function toggleCheckbox (eChecked, test) {
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
selectedTests = eChecked ? [...selectedTests, test] : selectedTests.filter(el => el !== test)
self.data.selectedTests = selectedTests
let checkAll = document.querySelector('[id="checkAllTests"]')
let checkAll = self._view.el.querySelector('[id="checkAllTests"]')
if (eChecked) {
checkAll.checked = true
} else if (!selectedTests.length) {
@ -152,8 +152,8 @@ module.exports = class TestTab {
}
function checkAll (event) {
let checkBoxes = document.querySelectorAll('.singleTest')
const checkboxesLabels = document.querySelectorAll('.singleTestLabel')
let checkBoxes = self._view.el.querySelectorAll('.singleTest')
const checkboxesLabels = self._view.el.querySelectorAll('.singleTestLabel')
// checks/unchecks all
for (let i = 0; i < checkBoxes.length; i++) {
checkBoxes[i].checked = event.target.checked

Loading…
Cancel
Save