This repository has been archived by the owner. It is now read-only.
Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
47 changed files
with
207 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BIN
+21.3 KB
Res/img/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -1,15 +1,49 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
var app = { | ||
// Application Constructor | ||
initialize: function() { | ||
this.bind(); | ||
this.bindEvents(); | ||
}, | ||
bind: function() { | ||
document.addEventListener('deviceready', this.deviceready, false); | ||
// Bind Event Listeners | ||
// | ||
// Bind any events that are required on startup. Common events are: | ||
// 'load', 'deviceready', 'offline', and 'online'. | ||
bindEvents: function() { | ||
document.addEventListener('deviceready', this.onDeviceReady, false); | ||
}, | ||
deviceready: function() { | ||
app.report('deviceready'); | ||
// deviceready Event Handler | ||
// | ||
// The scope of 'this' is the event. In order to call the 'receivedEvent' | ||
// function, we must explicity call 'app.receivedEvent(...);' | ||
onDeviceReady: function() { | ||
app.receivedEvent('deviceready'); | ||
}, | ||
report: function(id) { | ||
document.querySelector('#' + id + ' .pending').classList.add('hide'); | ||
document.querySelector('#' + id + ' .complete').classList.remove('hide'); | ||
// Update DOM on a Received Event | ||
receivedEvent: function(id) { | ||
var parentElement = document.getElementById(id); | ||
var listeningElement = parentElement.querySelector('.listening'); | ||
var receivedElement = parentElement.querySelector('.received'); | ||
|
||
listeningElement.setAttribute('style', 'display:none;'); | ||
receivedElement.setAttribute('style', 'display:block;'); | ||
|
||
console.log('Received Event: ' + id); | ||
} | ||
}; |
BIN
+3.02 KB
Res/res/icon/android/icon-36-ldpi.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+3.99 KB
Res/res/icon/android/icon-48-mdpi.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+5.94 KB
Res/res/icon/android/icon-72-hdpi.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+7.5 KB
Res/res/icon/android/icon-96-xhdpi.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+4.01 KB
Res/res/icon/bada-wac/icon-48-type5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+5.62 KB
Res/res/icon/bada-wac/icon-50-type3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+7.12 KB
Res/res/icon/bada-wac/icon-80-type4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+11.1 KB
Res/res/icon/bada/icon-128.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+7.12 KB
Res/res/icon/blackberry/icon-80.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+7.68 KB
Res/res/icon/ios/icon-57-2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+3.82 KB
Res/res/icon/ios/icon-57.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+11.4 KB
Res/res/icon/ios/icon-72-2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+4.83 KB
Res/res/icon/ios/icon-72.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+5.33 KB
Res/res/icon/webos/icon-64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+22.3 KB
Res/res/icon/windows-phone/icon-173-tile.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+4.01 KB
Res/res/icon/windows-phone/icon-48.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+7.15 KB
Res/res/icon/windows-phone/icon-62-tile.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+88.4 KB
Res/res/screen/android/screen-mdpi-portrait.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+88.4 KB
Res/res/screen/bada-wac/screen-type3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+217 KB
Res/res/screen/bada-wac/screen-type4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+105 KB
Res/res/screen/bada-wac/screen-type5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+217 KB
Res/res/screen/bada/screen-portrait.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+16.4 KB
Res/res/screen/blackberry/screen-225.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+1.46 MB
Res/res/screen/ios/screen-ipad-landscape-2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+1.54 MB
Res/res/screen/ios/screen-ipad-portrait-2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+413 KB
Res/res/screen/ios/screen-ipad-portrait.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+90.1 KB
Res/res/screen/ios/screen-iphone-landscape.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+91.7 KB
Res/res/screen/ios/screen-iphone-portrait.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN
+5.33 KB
Res/res/screen/webos/screen-64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -1,49 +1,67 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
describe('app', function() { | ||
describe('initialize', function() { | ||
it('should bind deviceready', function() { | ||
runs(function() { | ||
spyOn(app, 'deviceready'); | ||
spyOn(app, 'onDeviceReady'); | ||
app.initialize(); | ||
helper.trigger(window.document, 'deviceready'); | ||
}); | ||
|
||
waitsFor(function() { | ||
return (app.deviceready.calls.length > 0); | ||
}, 'deviceready should be called once', 500); | ||
return (app.onDeviceReady.calls.length > 0); | ||
}, 'onDeviceReady should be called once', 500); | ||
|
||
runs(function() { | ||
expect(app.deviceready).toHaveBeenCalled(); | ||
expect(app.onDeviceReady).toHaveBeenCalled(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('deviceready', function() { | ||
describe('onDeviceReady', function() { | ||
it('should report that it fired', function() { | ||
spyOn(app, 'report'); | ||
app.deviceready(); | ||
expect(app.report).toHaveBeenCalledWith('deviceready'); | ||
spyOn(app, 'receivedEvent'); | ||
app.onDeviceReady(); | ||
expect(app.receivedEvent).toHaveBeenCalledWith('deviceready'); | ||
}); | ||
}); | ||
|
||
describe('report', function() { | ||
describe('receivedEvent', function() { | ||
beforeEach(function() { | ||
var el = document.getElementById('stage'); | ||
el.innerHTML = ['<div id="deviceready">', | ||
' <p class="status pending">Pending</p>', | ||
' <p class="status complete hide">Complete</p>', | ||
' <p class="event listening">Listening</p>', | ||
' <p class="event received">Received</p>', | ||
'</div>'].join('\n'); | ||
}); | ||
|
||
it('should show the completion state', function() { | ||
app.report('deviceready'); | ||
var el = document.querySelector('#deviceready .complete:not(.hide)'); | ||
expect(el).toBeTruthy(); | ||
it('should hide the listening element', function() { | ||
app.receivedEvent('deviceready'); | ||
var displayStyle = helper.getComputedStyle('#deviceready .listening', 'display'); | ||
expect(displayStyle).toEqual('none'); | ||
}); | ||
|
||
it('should hide the pending state', function() { | ||
app.report('deviceready'); | ||
var el = document.querySelector('#deviceready .pending.hide'); | ||
expect(el).toBeTruthy(); | ||
it('should show the received element', function() { | ||
app.receivedEvent('deviceready'); | ||
var displayStyle = helper.getComputedStyle('#deviceready .received', 'display'); | ||
expect(displayStyle).toEqual('block'); | ||
}); | ||
}); | ||
}); |