Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
17
gaia/tv_apps/notification-sender/test/unit/.jshintrc
Executable file
17
gaia/tv_apps/notification-sender/test/unit/.jshintrc
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "../../../../.jshintrc",
|
||||
"predef": [
|
||||
"assert",
|
||||
"suite",
|
||||
"test",
|
||||
"setup",
|
||||
"teardown",
|
||||
"suiteSetup",
|
||||
"suiteTeardown",
|
||||
"require",
|
||||
"requireApp",
|
||||
"sinon",
|
||||
"mocha",
|
||||
"loadBodyHTML"
|
||||
]
|
||||
}
|
||||
78
gaia/tv_apps/notification-sender/test/unit/notification_sender_test.js
Executable file
78
gaia/tv_apps/notification-sender/test/unit/notification_sender_test.js
Executable file
|
|
@ -0,0 +1,78 @@
|
|||
/* globals NotificationSender, MockPresentation, MockPresentationSession */
|
||||
'use strict';
|
||||
|
||||
require('/bower_components/smart-button/script.js');
|
||||
require('/shared/test/unit/mocks/mock_presentation.js');
|
||||
require('/shared/test/unit/mocks/mock_presentation_session.js');
|
||||
|
||||
|
||||
suite('NotificationSender >', function() {
|
||||
var subject;
|
||||
var realPresentation;
|
||||
var urlInput;
|
||||
|
||||
suiteSetup(function(done) {
|
||||
urlInput = document.createElement('input');
|
||||
urlInput.id = 'url-input';
|
||||
urlInput.value = 'http://www.test.url.goes.here';
|
||||
document.body.appendChild(urlInput);
|
||||
|
||||
require('/tv_apps/notification-sender/js/notification_sender.js', done);
|
||||
|
||||
});
|
||||
|
||||
suiteTeardown(function() {
|
||||
document.body.removeChild(urlInput);
|
||||
});
|
||||
|
||||
setup(function() {
|
||||
subject = new NotificationSender();
|
||||
realPresentation = navigator.mozPresentation;
|
||||
navigator.mozPresentation = MockPresentation;
|
||||
|
||||
});
|
||||
|
||||
teardown(function() {
|
||||
navigator.mozPresentation = realPresentation;
|
||||
MockPresentation._mReset();
|
||||
MockPresentationSession._mReset();
|
||||
});
|
||||
|
||||
test('connect() should enable buttons', function(done) {
|
||||
var spy = this.sinon.spy(subject, 'disableButtons');
|
||||
spy.withArgs(false);
|
||||
|
||||
subject.connect().then(function() {
|
||||
assert.isTrue(spy.withArgs(false).calledOnce);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('connect() should listen to session.onstatechange', function(done) {
|
||||
assert.isUndefined(MockPresentationSession._onstatechange);
|
||||
|
||||
subject.connect().then(function() {
|
||||
assert.isFunction(MockPresentationSession._onstatechange);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
suite('Connected behaviors > ', function() {
|
||||
setup(function(done) {
|
||||
subject.connect().then(function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('sendMessage() should call session.sendMessage', function() {
|
||||
var data = {data: 'hello, world'};
|
||||
var dataJSON = JSON.stringify(data);
|
||||
var spy = this.sinon.spy(MockPresentationSession, 'send');
|
||||
spy.withArgs(dataJSON);
|
||||
|
||||
subject.sendMessage(data);
|
||||
assert.isTrue(spy.withArgs(dataJSON).calledOnce);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
4
gaia/tv_apps/notification-sender/test/unit/setup.js
Executable file
4
gaia/tv_apps/notification-sender/test/unit/setup.js
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
require('/shared/test/unit/mocks/mocks_helper.js');
|
||||
Loading…
Reference in a new issue