Esempio n. 1
0
 it('bind close event', function() {
     example = new Dialog({
         content: 'http://jsfiddle.net/afc163/CzQKp/show/'
     });
     example.show();
     expect(example.get('visible')).to.be.ok();
     var iframe = example.$('iframe')[0];
     iframe.trigger('close');
     expect(example.get('visible')).not.to.be.ok();
 });
Esempio n. 2
0
 it('click close to hide', function() {
     example = new Dialog({
         content: 'http://jsfiddle.net/afc163/CzQKp/show/'
     });
     expect(example.get('visible')).not.to.be.ok();
     example.show();
     expect(example.get('visible')).to.be.ok();
     example.element.find('[data-role=close]').click();
     expect(example.get('visible')).not.to.be.ok();
 });
Esempio n. 3
0
 it('bind key close event when iframe', function() {
     example = new Dialog({
         content: 'http://jsfiddle.net/afc163/CzQKp/show/'
     });
     example.show();
     expect(example.get('visible')).to.be.ok();
     // 模拟一个键盘事件
     var e = $.Event('keyup');
     e.keyCode = 27;
     example.element.trigger(e);
     expect(example.get('visible')).not.to.be.ok();
 });
Esempio n. 4
0
 it('bind key close event', function() {
     example = new Dialog({
         content: 'xxxx'
     });
     example.show();
     expect(example.get('visible')).to.be.ok();
     // 模拟一个键盘事件
     var e = $.Event('keyup');
     e.keyCode = 27;
     example.element.trigger(e);
     expect(example.get('visible')).not.to.be.ok();
 });
Esempio n. 5
0
 it('click trigger to show', function() {
     var test = $('<div id="test"></div>');
     test.appendTo('body');
     example = new Dialog({
         content: 'xxx',
         trigger: '#test'
     });
     expect(example.get('visible')).not.to.be.ok();
     test.click();
     expect(example.get('visible')).to.be.ok();
     test.remove();
 });
Esempio n. 6
0
 it('fade effect should work', function(done) {
     example = new Dialog({
         content: 'xxx',
         effect: 'fade',
         duration: 1000
     });
     expect(example.get('effect')).to.be('fade');
     example.show();
     setTimeout(function() {
         expect(example.element.css('opacity')).to.be.within(0, 1);
         done();
     }, 30);
 });
Esempio n. 7
0
 it('should be fixed height when set height', function(done) {
     example = new Dialog({
         content: 'http://jsfiddle.net/afc163/CzQKp/show/',
         height: 200,
         autoFit: true
     });
     expect(example.get('height')).to.be(200);
     example.show();
     expect(example.element.height()).to.be(200);
     setTimeout(function() {
         expect(example.element.height()).to.be(200);
         done();
     }, 500);
 });