Skip to content

Commit 93e0191

Browse files
committed
chore(travis): make tests work with phantomjs
1 parent 57c79a3 commit 93e0191

File tree

4 files changed

+27
-32
lines changed

4 files changed

+27
-32
lines changed

gulpfile.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,15 @@ gulp.task('cloudtest', ['protractor-sauce'], function(cb) {
377377
});
378378

379379
gulp.task('karma', function(cb) {
380-
return karma.start(_.assign(require('./config/karma.conf.js'), {singleRun: true}), cb);
380+
var config = require('./config/karma.conf.js');
381+
config.singleRun = true;
382+
if (argv.browsers) {
383+
config.browsers = argv.browsers.trim().split(',');
384+
}
385+
if (argv.reporters) {
386+
config.reporters = argv.reporters.trim().split(',');
387+
}
388+
return karma.start(config, cb);
381389
});
382390
gulp.task('karma-watch', function(cb) {
383391
return karma.start(_.assign(require('./config/karma.conf.js'), {singleRun: false}), cb);
@@ -401,12 +409,6 @@ gulp.task('protractor-sauce', ['sauce-connect', 'connect-server'], function(cb)
401409
});
402410

403411
function karma(cb, args) {
404-
if (argv.browsers) {
405-
args.push('--browsers='+argv.browsers.trim());
406-
}
407-
if (argv.reporters) {
408-
args.push('--reporters='+argv.reporters.trim());
409-
}
410412
cp.spawn('node', [
411413
__dirname + '/node_modules/karma/bin/karma',
412414
'start'

js/angular/directive/keyboardAttach.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
*
77
* @description
88
* keyboard-attach is an attribute directive which will cause an element to float above
9-
* the keyboard when the keyboard shows. Currently only supports the
9+
* the keyboard when the keyboard shows. Currently only supports the
1010
* [ion-footer-bar]({{ page.versionHref }}/api/directive/ionFooterBar/) directive.
11-
*
12-
* ### Notes
13-
* - This directive requires the
11+
*
12+
* ### Notes
13+
* - This directive requires the
1414
* [Ionic Keyboard Plugin](https://github.com/driftyco/ionic-plugins-keyboard).
1515
* - On Android not in fullscreen mode, i.e. you have
1616
* `<preference name="Fullscreen" value="true" />` in your `config.xml` file,
@@ -30,12 +30,12 @@
3030
IonicModule
3131
.directive('keyboardAttach', function() {
3232
return function(scope, element, attrs) {
33-
window.addEventListener('native.keyboardshow', onShow);
34-
window.addEventListener('native.keyboardhide', onHide);
33+
ionic.on('native.keyboardshow', onShow, window);
34+
ionic.on('native.keyboardhide', onHide, window);
3535

3636
//deprecated
37-
window.addEventListener('native.showkeyboard', onShow);
38-
window.addEventListener('native.hidekeyboard', onHide);
37+
ionic.on('native.showkeyboard', onShow, window);
38+
ionic.on('native.hidekeyboard', onHide, window);
3939

4040

4141
var scrollCtrl;
@@ -66,11 +66,12 @@ IonicModule
6666
}
6767

6868
scope.$on('$destroy', function() {
69-
window.removeEventListener('native.keyboardshow', onShow);
70-
window.removeEventListener('native.keyboardhide', onHide);
71-
72-
window.removeEventListener('native.showkeyboard', onShow);
73-
window.removeEventListener('native.hidekeyboard', onHide);
69+
ionic.off('native.keyboardshow', onShow, window);
70+
ionic.off('native.keyboardhide', onHide, window);
71+
72+
//deprecated
73+
ionic.off('native.showkeyboard', onShow, window);
74+
ionic.off('native.hidekeyboard', onHide, window);
7475
});
7576
};
7677
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ionic",
33
"private": false,
4-
"version": "1.0.0-beta.5b",
4+
"version": "1.0.0-beta.5b-nightly-22740",
55
"codename": "cadmium-camel",
66
"repository": {
77
"url": "git://github.com/driftyco/ionic.git"

test/unit/angular/directive/keyboardAttach.unit.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,10 @@ describe('keyboardAttach directive', function() {
4646
});
4747

4848
it('should remove listeners on destroy', function() {
49-
spyOn(window, 'removeEventListener');
49+
spyOn(ionic, 'off');
5050
var el = setup().el;
5151
el.scope().$destroy();
52-
expect(window.removeEventListener).toHaveBeenCalledWith('native.showkeyboard', jasmine.any(Function));
53-
expect(window.removeEventListener).toHaveBeenCalledWith('native.hidekeyboard', jasmine.any(Function));
54-
});
55-
56-
it('should remove listeners on destroy', function() {
57-
spyOn(window, 'removeEventListener');
58-
var el = setup().el;
59-
el.scope().$destroy();
60-
expect(window.removeEventListener).toHaveBeenCalledWith('native.showkeyboard', jasmine.any(Function));
61-
expect(window.removeEventListener).toHaveBeenCalledWith('native.hidekeyboard', jasmine.any(Function));
52+
expect(ionic.off).toHaveBeenCalledWith('native.keyboardshow', jasmine.any(Function), window);
53+
expect(ionic.off).toHaveBeenCalledWith('native.keyboardhide', jasmine.any(Function), window);
6254
});
6355
})

0 commit comments

Comments
 (0)