diff --git a/.gitignore b/.gitignore index 07966d4..bb7d361 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,10 @@ /test/lib/ /coverage/ /test/playground.html -eruda* +eruda.js +!/test/eruda.js +eruda.min.js +eruda.js.map /script/icomoon/ /src/**/*.js.map npm-debug.log \ No newline at end of file diff --git a/test/eruda.html b/test/eruda.html new file mode 100644 index 0000000..619addc --- /dev/null +++ b/test/eruda.html @@ -0,0 +1,17 @@ + + + + + + Features + + + + + + + + + + + diff --git a/test/eruda.js b/test/eruda.js new file mode 100644 index 0000000..221d6cd --- /dev/null +++ b/test/eruda.js @@ -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); + }); +}); \ No newline at end of file