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

Dev: Complete test and switch phantomjs to chrome headless

This commit is contained in:
surunzi
2017-11-05 22:22:25 +08:00
parent 3219e26eb1
commit 03468823c5
14 changed files with 1025 additions and 244 deletions

View File

@@ -8,6 +8,14 @@ describe('snippets', function ()
it('border all', function ()
{
expect($tool.find('.eruda-name').eq(0)).toContainText('Border All');
var $body = $('body'),
$btn = $tool.find('.eruda-run').eq(0);
$btn.click();
expect($body).toHaveCss({outlineWidth: '2px'});
$btn.click();
expect($body).toHaveCss({outlineWidth: '0px'});
});
it('refresh page', function ()
@@ -23,31 +31,36 @@ describe('snippets', function ()
it('edit page', function ()
{
expect($tool.find('.eruda-name').eq(3)).toContainText('Edit Page');
var $body = $('body'),
$btn = $tool.find('.eruda-run').eq(3);
$btn.click();
expect($body).toHaveAttr('contenteditable', 'true');
$btn.click();
expect($body).toHaveAttr('contenteditable', 'false');
});
});
describe('basic', function ()
it('clear', function ()
{
it('clear', function ()
{
tool.clear();
expect($tool.find('.eruda-name')).toHaveLength(0);
});
tool.clear();
expect($tool.find('.eruda-name')).toHaveLength(0);
});
it('add', function ()
it('add', function ()
{
tool.add('Test', function ()
{
tool.add('Test', function ()
{
console.log('eruda');
}, 'This is the description');
expect($tool.find('.eruda-name')).toContainText('Test');
expect($tool.find('.eruda-description')).toContainText('This is the description');
});
console.log('eruda');
}, 'This is the description');
expect($tool.find('.eruda-name')).toContainText('Test');
expect($tool.find('.eruda-description')).toContainText('This is the description');
});
it('remove', function ()
{
tool.remove('Test');
expect($tool.find('.eruda-name')).toHaveLength(0);
});
it('remove', function ()
{
tool.remove('Test');
expect($tool.find('.eruda-name')).toHaveLength(0);
});
});