1
0
mirror of synced 2025-12-07 22:18:17 +08:00

Dev: Settings karma test

This commit is contained in:
surunzi
2017-10-01 14:49:02 +08:00
parent c09e0cceca
commit 394728f482
4 changed files with 20 additions and 6 deletions

View File

@@ -162,11 +162,11 @@ Allow you to register small functions that can be triggered multiple times.
### clear
Clear Snippets.
Clear snippets.
### add
Add Snippet.
Add snippet.
|Name|Type |Desc |
|----|--------|------------------------|
@@ -203,6 +203,10 @@ related materials in [Can I Use](http://caniuse.com/) website.
Customization for all tools.
### clear
Clear settings.
### text
Add text.

View File

@@ -18,7 +18,7 @@ module.exports = function (config)
'test/resources.js',
'test/snippets.js',
'test/sources.js',
// 'test/settings.js'
'test/settings.js'
],
plugins: [
'karma-jasmine',

View File

@@ -20,6 +20,11 @@ export default class Settings extends Tool
this._bindEvent();
}
clear()
{
this._settings = [];
this._$el.html('');
}
switch(config, key, desc)
{
this._settings.push({config, key});

View File

@@ -7,6 +7,11 @@ cfg.set({
testSelect: ['1']
});
beforeEach(function ()
{
tool.clear();
});
describe('switch', function ()
{
it('ui', function ()
@@ -14,7 +19,7 @@ describe('switch', function ()
var text = 'Test Switch';
tool.switch(cfg, 'testSwitch', text);
expect($tool.find('.eruda-switch').eq(3)).toContainText(text);
expect($tool.find('.eruda-switch')).toContainText(text);
});
});
@@ -23,7 +28,7 @@ describe('separator', function ()
it('ui', function ()
{
tool.separator();
expect($tool.find('.eruda-separator').length).toEqual(4);
expect($tool.find('.eruda-separator').length).toEqual(1);
});
});
@@ -34,7 +39,7 @@ describe('select', function ()
var text = 'Test Select';
tool.select(cfg, 'testSelect', text, ['1', '2', '3']);
var $el = $tool.find('.eruda-select').eq(2);
var $el = $tool.find('.eruda-select');
expect($el.find('ul li').length).toEqual(3);
expect($el.find('.eruda-val')).toContainText('1');
});