diff --git a/client/dom/current-file.spec.js b/client/dom/current-file.spec.js index 780a31c5..79cde62b 100644 --- a/client/dom/current-file.spec.js +++ b/client/dom/current-file.spec.js @@ -1,6 +1,7 @@ 'use strict'; const test = require('tape'); +const {create} = require('auto-globals'); const stub = require('@cloudcmd/stub'); const id = (a) => a; const wraptile = require('wraptile'); @@ -18,10 +19,8 @@ test('current-file: setCurrentName: setAttribute', (t) => { global.DOM = getDOM(); global.CloudCmd = getCloudCmd(); - const setAttribute = stub(); - const current = { - setAttribute - }; + const current = create(); + const {setAttribute} = current; currentFile.setCurrentName('hello', current); @@ -42,10 +41,8 @@ test('current-file: setCurrentName: setAttribute: cyrillic', (t) => { global.DOM = getDOM(); global.CloudCmd = getCloudCmd(); - const setAttribute = stub(); - const current = { - setAttribute - }; + const current = create(); + const {setAttribute} = current; currentFile.setCurrentName('ай', current); @@ -64,16 +61,13 @@ test('current-file: emit', (t) => { } = global; const emit = stub(); - const setAttribute = stub(); global.DOM = getDOM(); global.CloudCmd = getCloudCmd({ emit, }); - const current = { - setAttribute, - }; + const current = create(); currentFile.setCurrentName('hello', current); @@ -91,7 +85,6 @@ test('current-file: setCurrentName: return', (t) => { CloudCmd, } = global; - const setAttribute = stub(); const link = {}; global.DOM = getDOM({ @@ -100,9 +93,7 @@ test('current-file: setCurrentName: return', (t) => { global.CloudCmd = getCloudCmd(); - const current = { - setAttribute, - }; + const current = create(); const result = currentFile.setCurrentName('hello', current); diff --git a/client/dom/dom-tree.spec.js b/client/dom/dom-tree.spec.js index 0acb6302..49930704 100644 --- a/client/dom/dom-tree.spec.js +++ b/client/dom/dom-tree.spec.js @@ -1,7 +1,7 @@ 'use strict'; const test = require('tape'); -const stub = require('@cloudcmd/stub'); +const {create} = require('auto-globals'); const tryCatch = require('try-catch'); const { @@ -21,12 +21,8 @@ test('dom: isContainClass: no className', (t) => { }); test('dom: isContainClass: contains', (t) => { - const contains = stub(); - const el = { - classList: { - contains, - } - }; + const el = create(); + const {contains} = el.classList; const className = 'hello'; isContainClass(el, className); @@ -36,12 +32,8 @@ test('dom: isContainClass: contains', (t) => { }); test('dom: isContainClass: contains: array', (t) => { - const contains = stub(); - const el = { - classList: { - contains, - } - }; + const el = create(); + const {contains} = el.classList; const className = 'hello'; isContainClass(el, [