Dev: Settings karma test
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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});
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user