mirror of
https://github.com/liriliri/eruda.git
synced 2026-03-20 09:38:37 +08:00
Fix: Container test file ignored
This commit is contained in:
17
test/eruda.html
Normal file
17
test/eruda.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<title>Features</title>
|
||||
<link rel="stylesheet" href="lib/jasmine.css">
|
||||
<script src="lib/jquery.js"></script>
|
||||
<script src="lib/jasmine.js"></script>
|
||||
<script src="lib/jasmine-html.js"></script>
|
||||
<script src="assets/eruda.js"></script>
|
||||
<script src="boot.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>boot('eruda');</script>
|
||||
</body>
|
||||
</html>
|
||||
83
test/eruda.js
Normal file
83
test/eruda.js
Normal file
@@ -0,0 +1,83 @@
|
||||
describe('init', function ()
|
||||
{
|
||||
it('destroy', function ()
|
||||
{
|
||||
eruda.destroy();
|
||||
|
||||
expect($('#eruda')).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('init', function ()
|
||||
{
|
||||
var container = document.createElement('div');
|
||||
container.id = 'eruda';
|
||||
document.body.appendChild(container);
|
||||
|
||||
eruda.init({
|
||||
container: container,
|
||||
tool: []
|
||||
});
|
||||
|
||||
var $eruda = $('#eruda');
|
||||
expect($eruda.find('.eruda-dev-tools')).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('tool', function ()
|
||||
{
|
||||
it('add', function ()
|
||||
{
|
||||
eruda.add({
|
||||
name: 'test',
|
||||
init: function ($el)
|
||||
{
|
||||
this._$el = $el;
|
||||
$el.html('Test Plugin');
|
||||
}
|
||||
});
|
||||
|
||||
expect($('.eruda-test')).toContainText('Test Plugin');
|
||||
});
|
||||
|
||||
it('show', function ()
|
||||
{
|
||||
var $tool = $('.eruda-test');
|
||||
expect($tool).toBeHidden();
|
||||
eruda.show('test');
|
||||
expect($tool).toHaveCss({display: 'block'});
|
||||
});
|
||||
|
||||
it('remove', function ()
|
||||
{
|
||||
eruda.remove('test');
|
||||
expect($('.eruda-test')).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('display', function ()
|
||||
{
|
||||
it('show', function ()
|
||||
{
|
||||
eruda.show();
|
||||
expect($('.eruda-dev-tools')).toHaveCss({display: 'block'});
|
||||
});
|
||||
|
||||
it('hide', function (done)
|
||||
{
|
||||
eruda.hide();
|
||||
setTimeout(function ()
|
||||
{
|
||||
expect($('.eruda-dev-tools')).toBeHidden();
|
||||
done();
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
|
||||
describe('scale', function ()
|
||||
{
|
||||
it('get', function ()
|
||||
{
|
||||
eruda.scale(1);
|
||||
expect(eruda.scale()).toBe(1);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user