Dev: Console refactoring

This commit is contained in:
surunzi
2016-08-22 22:06:55 +08:00
parent 9ff8d8cd22
commit 7d47d007a4
9 changed files with 471 additions and 352 deletions

View File

@@ -18,12 +18,47 @@ describe('log', function ()
tool.clear().log(obj);
expect($tool.find('.eruda-log')).toContainText('Object {"a":1}');
});
it('html', function ()
{
tool.clear().html('<span class="color-blue">Blue</span>');
expect($tool.find('.eruda-html')).toContainElement('span.color-blue');
});
it('timer', function ()
{
tool.clear().time('eruda');
tool.clear().timeEnd('eruda');
expect($tool.find('.eruda-html')).toHaveText(/eruda: \d+ms/);
});
});
describe('substitution', function ()
{
it('number', function ()
{
tool.clear().log('Eruda is %d', 1, 'year old');
expect($tool.find('.eruda-log')).toContainText('Eruda is 1 year old');
});
it('string', function ()
{
tool.clear().log('My name is %s', 'eruda');
expect($tool.find('.eruda-log')).toContainText('My name is eruda');
});
it('object', function ()
{
tool.clear().log('Object is %o', {a: 1});
expect($tool.find('.eruda-log')).toContainText('Object is {"a":1}');
});
});
describe('filter', function ()
{
// Test case from https://github.com/liriliri/eruda/issues/14
it('function', function ()
/*it('function', function ()
{
tool.clear().filter(function (log)
{
@@ -41,5 +76,5 @@ describe('filter', function ()
});
tool.log(obj);
expect($tool.find('.eruda-logs li').length).toEqual(1);
});
});*/
});