Browse Source

Improve tests

simov 7 years ago
parent
commit
439538ad2f
7 changed files with 249 additions and 162 deletions
  1. 7 0
      test/defaults-options.js
  2. 12 1
      test/index.js
  3. 78 0
      test/origin-add.js
  4. 123 76
      test/origin-csp.js
  5. 11 19
      test/origin-encoding.js
  6. 14 57
      test/origin-match.js
  7. 4 9
      test/popup-options.js

+ 7 - 0
test/defaults-options.js

@@ -26,6 +26,13 @@ module.exports = ({advanced}) => {
       true,
       'state.header should be true'
     )
+    t.strictEqual(
+      await advanced.evaluate(() =>
+        document.querySelector('.m-switch')
+      ),
+      null,
+      'header detection switch should be hidden'
+    )
   })
 
   it('allowed origins', async () => {

+ 12 - 1
test/index.js

@@ -19,6 +19,7 @@ var tests = [
 
   'popup-options',
 
+  'origin-add',
   'origin-match',
   'origin-encoding',
   'origin-csp', // should be last - destroys popup and advanced
@@ -59,6 +60,7 @@ describe('markdown-viewer', () => {
     await new Promise((resolve, reject) => {
       server = http.createServer()
       server.on('request', (req, res) => {
+        // content-type
         if (/wrong-content-type/.test(req.url)) {
           res.setHeader('Content-Type', 'text/plain')
           res.end('**bold**')
@@ -71,6 +73,7 @@ describe('markdown-viewer', () => {
           res.setHeader('Content-Type', 'text/x-markdown')
           res.end('**bold**')
         }
+        // popup options
         else if (/compiler-options-marked/.test(req.url)) {
           res.setHeader('Content-Type', 'text/x-markdown')
           res.end('~~strikethrough~~')
@@ -94,16 +97,24 @@ describe('markdown-viewer', () => {
             Array(500).fill('lorem ipsum').join(' '),
           ].join('\n\n'))
         }
+        // csp
+        else if (/csp-match-header/.test(req.url)) {
+          res.setHeader('Content-Security-Policy',
+            `default-src 'none'; style-src 'unsafe-inline'; sandbox`)
+          res.setHeader('Content-Type', 'text/markdown')
+          res.end('# h1')
+        }
         else if (/csp-match-path/.test(req.url)) {
           res.setHeader('Content-Security-Policy',
             `default-src 'none'; style-src 'unsafe-inline'; sandbox`)
           res.end('# h1')
         }
-        else if (/csp-wrong-path/.test(req.url)) {
+        else if (/csp-no-header-no-path/.test(req.url)) {
           res.setHeader('Content-Security-Policy',
             `default-src 'none'; style-src 'unsafe-inline'; sandbox`)
           res.end('# h1')
         }
+        // encoding
         else if (/windows-1251/.test(req.url)) {
           res.setHeader('Content-Type', 'text/markdown; charset=UTF-8')
           res.end(iconv.encode('здрасти', 'win1251'))

+ 78 - 0
test/origin-add.js

@@ -0,0 +1,78 @@
+
+var t = require('assert')
+
+
+module.exports = ({advanced, content}) => {
+
+  before(async () => {
+    await advanced.bringToFront()
+
+    // remove origin
+    if (await advanced.evaluate(() => Object.keys(state.origins).length > 1)) {
+      // expand origin
+      if (!await advanced.evaluate(() => document.querySelector('.m-list li:nth-of-type(2)').classList.contains('m-expanded'))) {
+        await advanced.click('.m-list li:nth-of-type(2)')
+      }
+      await advanced.click('.m-list li:nth-of-type(2) .m-footer .m-button')
+    }
+
+    // add origin
+    await advanced.select('.m-select', 'http')
+    await advanced.type('[type=text]', 'localhost:3000')
+    await advanced.click('button')
+    await advanced.waitFor(200)
+
+    // expand origin
+    if (!await advanced.evaluate(() => document.querySelector('.m-list li:nth-of-type(2)').classList.contains('m-expanded'))) {
+      await advanced.click('.m-list li:nth-of-type(2)')
+    }
+  })
+
+  describe('defaults', () => {
+    it('localhost:3000', async () => {
+      t.equal(
+        await advanced.evaluate(() =>
+          document.querySelectorAll('.m-list li').length
+        ),
+        2,
+        'allowed origins count should be 2'
+      )
+      t.equal(
+        await advanced.evaluate(() =>
+          document.querySelector('.m-list li:nth-of-type(2) .m-origin').innerText
+        ),
+        'http://localhost:3000',
+        'origin name should be http://localhost:3000'
+      )
+      t.strictEqual(
+        await advanced.evaluate(() =>
+          document.querySelector('.m-list li:nth-of-type(2) .m-switch').classList.contains('is-checked')
+        ),
+        false,
+        'csp checkbox should be disabled'
+      )
+      t.equal(
+        await advanced.evaluate(() =>
+          document.querySelector('.m-list li:nth-of-type(2) .m-encoding select').value
+        ),
+        '',
+        'encoding should be set to auto'
+      )
+      t.strictEqual(
+        await advanced.evaluate(() =>
+          document.querySelectorAll('.m-list li:nth-of-type(2) .m-footer .m-button').length
+        ),
+        1,
+        'only one button should be visible in the origin footer'
+      )
+      t.equal(
+        await advanced.evaluate(() =>
+          document.querySelector('.m-list li:nth-of-type(2) .m-footer .m-button').innerText.toLowerCase()
+        ),
+        'remove',
+        'remove origin button should be rendered'
+      )
+    })
+  })
+
+}

+ 123 - 76
test/origin-csp.js

@@ -10,9 +10,7 @@ module.exports = ({extensions, advanced, content}) => {
     // remove origin
     if (await advanced.evaluate(() => Object.keys(state.origins).length > 1)) {
       // expand origin
-      if (!await advanced.evaluate(() =>
-        document.querySelector('.m-list li:nth-of-type(2)')
-          .classList.contains('m-expanded'))) {
+      if (!await advanced.evaluate(() => document.querySelector('.m-list li:nth-of-type(2)').classList.contains('m-expanded'))) {
         await advanced.click('.m-list li:nth-of-type(2)')
       }
       await advanced.click('.m-list li:nth-of-type(2) .m-footer .m-button')
@@ -26,91 +24,69 @@ module.exports = ({extensions, advanced, content}) => {
 
     // expand origin
     if (!await advanced.evaluate(() =>
-      document.querySelector('.m-list li:nth-of-type(2)')
-        .classList.contains('m-expanded'))) {
+      document.querySelector('.m-list li:nth-of-type(2)').classList.contains('m-expanded'))) {
       await advanced.click('.m-list li:nth-of-type(2)')
     }
 
+    // enable header detection
+    if (!await advanced.evaluate(() => state.header)) {
+      await advanced.click('.m-switch')
+    }
+
     // enable path matching
     await advanced.evaluate(() => {
-      document.querySelector('.m-list li:nth-of-type(2) input')
-        .value = 'csp-match-path'
-      document.querySelector('.m-list li:nth-of-type(2) input')
-        .dispatchEvent(new Event('keyup'))
+      document.querySelector('.m-list li:nth-of-type(2) input').value = 'csp-match-path'
+      document.querySelector('.m-list li:nth-of-type(2) input').dispatchEvent(new Event('keyup'))
     })
     // there is debounce timeout of 750ms in the options UI
     await advanced.waitFor(800)
   })
 
-  describe('preserve state', () => {
-    it('enable csp', async () => {
+  describe('not correct content-type + non matching path', () => {
+    before(async () => {
       await advanced.bringToFront()
 
       // enable csp
       if (!await advanced.evaluate(() => state.origins['http://localhost:3000'].csp)) {
         await advanced.click('.m-list li:nth-of-type(2) .m-switch')
       }
-      await advanced.reload()
-      await advanced.waitFor(200)
 
-      // expand origin
-      await advanced.click('.m-list li:nth-of-type(2)')
-
-      t.strictEqual(
-        await advanced.evaluate(() =>
-          document.querySelector('.m-list li:nth-of-type(2) .m-switch')
-            .classList.contains('is-checked')
-        ),
-        true,
-        'csp checkbox should be enabled'
-      )
+      // go to page serving content with strict csp
+      await content.goto('http://localhost:3000/csp-no-header-no-path')
+      await content.bringToFront()
+      await content.waitFor(200)
     })
-    it('disable csp', async () => {
-      await advanced.bringToFront()
-
-      // disable csp
-      if (await advanced.evaluate(() => state.origins['http://localhost:3000'].csp)) {
-        await advanced.click('.m-list li:nth-of-type(2) .m-switch')
-      }
-      await advanced.reload()
-      await advanced.waitFor(200)
-
-      // expand origin
-      await advanced.click('.m-list li:nth-of-type(2)')
-
+    it('non matching urls should be skipped', async () => {
       t.strictEqual(
-        await advanced.evaluate(() =>
-          document.querySelector('.m-list li:nth-of-type(2) .m-switch')
-            .classList.contains('is-checked')
-        ),
-        false,
-        'csp checkbox should be disabled'
+        await content.evaluate(() => {
+          try {
+            window.localStorage
+          }
+          catch (err) {
+            return err.message.split(':')[1].trim()
+          }
+        }),
+        `The document is sandboxed and lacks the 'allow-same-origin' flag.`,
+        'localStorage should not be accessible'
       )
     })
   })
 
-  describe('strip csp header only on matching content type or url', () => {
+  describe('correct content-type + non matching path', () => {
     before(async () => {
       await advanced.bringToFront()
 
-      // expand origin
-      if (!await advanced.evaluate(() =>
-        document.querySelector('.m-list li:nth-of-type(2)')
-          .classList.contains('m-expanded'))) {
-        await advanced.click('.m-list li:nth-of-type(2)')
-      }
-
       // enable csp
       if (!await advanced.evaluate(() => state.origins['http://localhost:3000'].csp)) {
         await advanced.click('.m-list li:nth-of-type(2) .m-switch')
       }
 
       // go to page serving content with strict csp
-      await content.goto('http://localhost:3000/csp-wrong-path')
+      await content.goto('http://localhost:3000/csp-match-header')
       await content.bringToFront()
       await content.waitFor(200)
     })
-    it('non matching urls should be skipped', async () => {
+    it('non matching urls cannot be checked for enabled csp', async () => {
       t.strictEqual(
         await content.evaluate(() => {
           try {
@@ -126,17 +102,10 @@ module.exports = ({extensions, advanced, content}) => {
     })
   })
 
-  describe('enable csp', () => {
+  describe('not correct content-type + matching path', () => {
     before(async () => {
       await advanced.bringToFront()
 
-      // expand origin
-      if (!await advanced.evaluate(() =>
-        document.querySelector('.m-list li:nth-of-type(2)')
-          .classList.contains('m-expanded'))) {
-        await advanced.click('.m-list li:nth-of-type(2)')
-      }
-
       // enable csp
       if (!await advanced.evaluate(() => state.origins['http://localhost:3000'].csp)) {
         await advanced.click('.m-list li:nth-of-type(2) .m-switch')
@@ -158,17 +127,58 @@ module.exports = ({extensions, advanced, content}) => {
     })
   })
 
-  describe('disable csp', () => {
-    before(async () => {
+  describe('disable - enable - disable', () => {
+    it('full cycle', async () => {
+      // 1. disable
       await advanced.bringToFront()
 
-      // expand origin
-      if (!await advanced.evaluate(() =>
-        document.querySelector('.m-list li:nth-of-type(2)')
-          .classList.contains('m-expanded'))) {
-        await advanced.click('.m-list li:nth-of-type(2)')
+      // disable csp
+      if (await advanced.evaluate(() => state.origins['http://localhost:3000'].csp)) {
+        await advanced.click('.m-list li:nth-of-type(2) .m-switch')
       }
 
+      // go to page serving content with strict csp
+      await content.goto('http://localhost:3000/csp-match-path')
+      await content.bringToFront()
+      await content.waitFor(200)
+
+      t.strictEqual(
+        await content.evaluate(() => {
+          try {
+            window.localStorage
+          }
+          catch (err) {
+            return err.message.split(':')[1].trim()
+          }
+        }),
+        `The document is sandboxed and lacks the 'allow-same-origin' flag.`,
+        'localStorage should not be accessible'
+      )
+
+      // 2. enable
+      await advanced.bringToFront()
+
+      // enable csp
+      if (!await advanced.evaluate(() => state.origins['http://localhost:3000'].csp)) {
+        await advanced.click('.m-list li:nth-of-type(2) .m-switch')
+      }
+
+      // go to page serving content with strict csp
+      await content.goto('http://localhost:3000/csp-match-path')
+      await content.bringToFront()
+      await content.waitFor(200)
+
+      t.strictEqual(
+        await content.evaluate(() =>
+          window.localStorage.toString()
+        ),
+        '[object Storage]',
+        'localStorage should be accessible'
+      )
+
+      // 3. disable
+      await advanced.bringToFront()
+
       // disable csp
       if (await advanced.evaluate(() => state.origins['http://localhost:3000'].csp)) {
         await advanced.click('.m-list li:nth-of-type(2) .m-switch')
@@ -178,8 +188,7 @@ module.exports = ({extensions, advanced, content}) => {
       await content.goto('http://localhost:3000/csp-match-path')
       await content.bringToFront()
       await content.waitFor(200)
-    })
-    it('webRequest.onHeadersReceived event is disabled', async () => {
+
       t.strictEqual(
         await content.evaluate(() => {
           try {
@@ -195,16 +204,54 @@ module.exports = ({extensions, advanced, content}) => {
     })
   })
 
-  describe('enable csp + suspend the event page', () => {
-    before(async () => {
+  describe('persist state', () => {
+    it('enable csp', async () => {
       await advanced.bringToFront()
 
+      // enable csp
+      if (!await advanced.evaluate(() => state.origins['http://localhost:3000'].csp)) {
+        await advanced.click('.m-list li:nth-of-type(2) .m-switch')
+      }
+      await advanced.reload()
+      await advanced.waitFor(200)
+
       // expand origin
-      if (!await advanced.evaluate(() =>
-        document.querySelector('.m-list li:nth-of-type(2)')
-          .classList.contains('m-expanded'))) {
-        await advanced.click('.m-list li:nth-of-type(2)')
+      await advanced.click('.m-list li:nth-of-type(2)')
+
+      t.strictEqual(
+        await advanced.evaluate(() =>
+          document.querySelector('.m-list li:nth-of-type(2) .m-switch').classList.contains('is-checked')
+        ),
+        true,
+        'csp checkbox should be enabled'
+      )
+    })
+    it('disable csp', async () => {
+      await advanced.bringToFront()
+
+      // disable csp
+      if (await advanced.evaluate(() => state.origins['http://localhost:3000'].csp)) {
+        await advanced.click('.m-list li:nth-of-type(2) .m-switch')
       }
+      await advanced.reload()
+      await advanced.waitFor(200)
+
+      // expand origin
+      await advanced.click('.m-list li:nth-of-type(2)')
+
+      t.strictEqual(
+        await advanced.evaluate(() =>
+          document.querySelector('.m-list li:nth-of-type(2) .m-switch').classList.contains('is-checked')
+        ),
+        false,
+        'csp checkbox should be disabled'
+      )
+    })
+  })
+
+  describe('enable csp + suspend the event page', () => {
+    before(async () => {
+      await advanced.bringToFront()
 
       // enable csp
       if (!await advanced.evaluate(() => state.origins['http://localhost:3000'].csp)) {

+ 11 - 19
test/origin-encoding.js

@@ -10,9 +10,7 @@ module.exports = ({advanced, content}) => {
     // remove origin
     if (await advanced.evaluate(() => Object.keys(state.origins).length > 1)) {
       // expand origin
-      if (!await advanced.evaluate(() =>
-        document.querySelector('.m-list li:nth-of-type(2)')
-          .classList.contains('m-expanded'))) {
+      if (!await advanced.evaluate(() => document.querySelector('.m-list li:nth-of-type(2)').classList.contains('m-expanded'))) {
         await advanced.click('.m-list li:nth-of-type(2)')
       }
       await advanced.click('.m-list li:nth-of-type(2) .m-footer .m-button')
@@ -25,18 +23,19 @@ module.exports = ({advanced, content}) => {
     await advanced.waitFor(200)
 
     // expand origin
-    if (!await advanced.evaluate(() =>
-      document.querySelector('.m-list li:nth-of-type(2)')
-        .classList.contains('m-expanded'))) {
+    if (!await advanced.evaluate(() => document.querySelector('.m-list li:nth-of-type(2)').classList.contains('m-expanded'))) {
       await advanced.click('.m-list li:nth-of-type(2)')
     }
 
+    // enable header detection
+    if (!await advanced.evaluate(() => state.header)) {
+      await advanced.click('.m-switch')
+    }
+
     // enable path matching
     await advanced.evaluate(() => {
-      document.querySelector('.m-list li:nth-of-type(2) input')
-        .value = 'windows-1251'
-      document.querySelector('.m-list li:nth-of-type(2) input')
-        .dispatchEvent(new Event('keyup'))
+      document.querySelector('.m-list li:nth-of-type(2) input').value = 'windows-1251'
+      document.querySelector('.m-list li:nth-of-type(2) input').dispatchEvent(new Event('keyup'))
     })
     // there is debounce timeout of 750ms in the options UI
     await advanced.waitFor(800)
@@ -67,10 +66,7 @@ module.exports = ({advanced, content}) => {
   describe('correct encoding', () => {
     before(async () => {
       await advanced.bringToFront()
-      // enable csp - required to enable the webRequest permission!
-      if (!await advanced.evaluate(() => state.origins['http://localhost:3000'].csp)) {
-        await advanced.click('.m-list li:nth-of-type(2) .m-switch')
-      }
+
       // set encoding
       await advanced.select('.m-list li:nth-of-type(2) .m-encoding select', 'Windows-1251')
 
@@ -100,11 +96,7 @@ module.exports = ({advanced, content}) => {
       await advanced.reload()
       await advanced.waitFor(200)
       // expand origin
-      if (!await advanced.evaluate(() =>
-        document.querySelector('.m-list li:nth-of-type(2)')
-          .classList.contains('m-expanded'))) {
-        await advanced.click('.m-list li:nth-of-type(2)')
-      }
+      await advanced.click('.m-list li:nth-of-type(2)')
     })
     it('reload', async () => {
       t.equal(

+ 14 - 57
test/origin-match.js

@@ -10,9 +10,7 @@ module.exports = ({advanced, content}) => {
     // remove origin
     if (await advanced.evaluate(() => Object.keys(state.origins).length > 1)) {
       // expand origin
-      if (!await advanced.evaluate(() =>
-        document.querySelector('.m-list li:nth-of-type(2)')
-          .classList.contains('m-expanded'))) {
+      if (!await advanced.evaluate(() => document.querySelector('.m-list li:nth-of-type(2)').classList.contains('m-expanded'))) {
         await advanced.click('.m-list li:nth-of-type(2)')
       }
       await advanced.click('.m-list li:nth-of-type(2) .m-footer .m-button')
@@ -23,28 +21,14 @@ module.exports = ({advanced, content}) => {
     await advanced.type('[type=text]', 'localhost:3000')
     await advanced.click('button')
     await advanced.waitFor(200)
-  })
 
-  describe('add origin', () => {
-    it('localhost:3000', async () => {
-      t.equal(
-        await advanced.evaluate(() =>
-          document.querySelectorAll('.m-list li').length
-        ),
-        2,
-        'allowed origins count should be 2'
-      )
-      t.equal(
-        await advanced.evaluate(() =>
-          document.querySelector('.m-list li:nth-of-type(2) .m-origin').innerText
-        ),
-        'http://localhost:3000',
-        'origin name should be http://localhost:3000'
-      )
-    })
+    // expand origin
+    if (!await advanced.evaluate(() => document.querySelector('.m-list li:nth-of-type(2)').classList.contains('m-expanded'))) {
+      await advanced.click('.m-list li:nth-of-type(2)')
+    }
   })
 
-  describe('disabled header detection + disabled path matching', () => {
+  describe('correct content-type + disabled header detection + disabled path matching', () => {
     before(async () => {
       await advanced.bringToFront()
 
@@ -53,19 +37,10 @@ module.exports = ({advanced, content}) => {
         await advanced.click('.m-switch')
       }
 
-      // expand origin
-      if (!await advanced.evaluate(() =>
-        document.querySelector('.m-list li:nth-of-type(2)')
-          .classList.contains('m-expanded'))) {
-        await advanced.click('.m-list li:nth-of-type(2)')
-      }
-
       // disable path matching
       await advanced.evaluate(() => {
-        document.querySelector('.m-list li:nth-of-type(2) input')
-          .value = ''
-        document.querySelector('.m-list li:nth-of-type(2) input')
-          .dispatchEvent(new Event('keyup'))
+        document.querySelector('.m-list li:nth-of-type(2) input').value = ''
+        document.querySelector('.m-list li:nth-of-type(2) input').dispatchEvent(new Event('keyup'))
       })
       // there is debounce timeout of 750ms in the options UI
       await advanced.waitFor(800)
@@ -86,7 +61,7 @@ module.exports = ({advanced, content}) => {
     })
   })
 
-  describe('enabled header detection + disabled path matching', () => {
+  describe('correct content-type + enabled header detection + disabled path matching', () => {
     before(async () => {
       await advanced.bringToFront()
 
@@ -95,19 +70,10 @@ module.exports = ({advanced, content}) => {
         await advanced.click('.m-switch')
       }
 
-      // expand origin
-      if (!await advanced.evaluate(() =>
-        document.querySelector('.m-list li:nth-of-type(2)')
-          .classList.contains('m-expanded'))) {
-        await advanced.click('.m-list li:nth-of-type(2)')
-      }
-
       // disable path matching
       await advanced.evaluate(() => {
-        document.querySelector('.m-list li:nth-of-type(2) input')
-          .value = ''
-        document.querySelector('.m-list li:nth-of-type(2) input')
-          .dispatchEvent(new Event('keyup'))
+        document.querySelector('.m-list li:nth-of-type(2) input').value = ''
+        document.querySelector('.m-list li:nth-of-type(2) input').dispatchEvent(new Event('keyup'))
       })
       // there is debounce timeout of 750ms in the options UI
       await advanced.waitFor(800)
@@ -142,7 +108,7 @@ module.exports = ({advanced, content}) => {
     })
   })
 
-  describe('enabled header detection + enabled path matching', () => {
+  describe('wrong content-type + enabled header detection + enabled path matching', () => {
     before(async () => {
       await advanced.bringToFront()
 
@@ -151,19 +117,10 @@ module.exports = ({advanced, content}) => {
         await advanced.click('.m-switch')
       }
 
-      // expand origin
-      if (!await advanced.evaluate(() =>
-        document.querySelector('.m-list li:nth-of-type(2)')
-          .classList.contains('m-expanded'))) {
-        await advanced.click('.m-list li:nth-of-type(2)')
-      }
-
       // enable path matching
       await advanced.evaluate(() => {
-        document.querySelector('.m-list li:nth-of-type(2) input')
-          .value = 'wrong-content-type'
-        document.querySelector('.m-list li:nth-of-type(2) input')
-          .dispatchEvent(new Event('keyup'))
+        document.querySelector('.m-list li:nth-of-type(2) input').value = 'wrong-content-type'
+        document.querySelector('.m-list li:nth-of-type(2) input').dispatchEvent(new Event('keyup'))
       })
       // there is debounce timeout of 750ms in the options UI
       await advanced.waitFor(800)

+ 4 - 9
test/popup-options.js

@@ -10,9 +10,7 @@ module.exports = ({popup, advanced, content}) => {
     // remove origin
     if (await advanced.evaluate(() => Object.keys(state.origins).length > 1)) {
       // expand origin
-      if (!await advanced.evaluate(() =>
-        document.querySelector('.m-list li:nth-of-type(2)')
-          .classList.contains('m-expanded'))) {
+      if (!await advanced.evaluate(() => document.querySelector('.m-list li:nth-of-type(2)').classList.contains('m-expanded'))) {
         await advanced.click('.m-list li:nth-of-type(2)')
       }
       await advanced.click('.m-list li:nth-of-type(2) .m-footer .m-button')
@@ -242,8 +240,7 @@ module.exports = ({popup, advanced, content}) => {
       )
       t.strictEqual(
         await popup.evaluate(() =>
-          document.querySelector('.m-panel:nth-of-type(2) .m-switch:nth-of-type(2)')
-            .classList.contains('is-checked')
+          document.querySelector('.m-panel:nth-of-type(2) .m-switch:nth-of-type(2)').classList.contains('is-checked')
         ),
         false,
         'dom gfm checkbox should be disabled'
@@ -292,8 +289,7 @@ module.exports = ({popup, advanced, content}) => {
       )
       t.strictEqual(
         await content.evaluate(() =>
-          document.querySelector('#_html ul li [type=checkbox]')
-            .hasAttribute('disabled')
+          document.querySelector('#_html ul li [type=checkbox]').hasAttribute('disabled')
         ),
         true,
         'dom li should contain checkbox in it'
@@ -353,8 +349,7 @@ module.exports = ({popup, advanced, content}) => {
       )
       t.strictEqual(
         await popup.evaluate(() =>
-          document.querySelector('.m-panel:nth-of-type(2) .m-switch:nth-of-type(4)')
-            .classList.contains('is-checked')
+          document.querySelector('.m-panel:nth-of-type(2) .m-switch:nth-of-type(4)').classList.contains('is-checked')
         ),
         false,
         'dom gfm checkbox should be disabled'