mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
test(client) dom: auto-globals
This commit is contained in:
parent
39822883d2
commit
afa34f7bcd
2 changed files with 12 additions and 29 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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, [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue