mirror of
https://github.com/apache/cordova-plugin-statusbar.git
synced 2026-04-27 00:00:06 +08:00
refactor(eslint): use cordova-eslint (#194)
This commit is contained in:
+74
-46
@@ -17,87 +17,86 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
*/
|
||||
|
||||
/* jshint jasmine: true */
|
||||
/* global StatusBar */
|
||||
|
||||
exports.defineAutoTests = function () {
|
||||
describe("StatusBar", function () {
|
||||
it("statusbar.spec.1 should exist", function() {
|
||||
describe('StatusBar', function () {
|
||||
it('statusbar.spec.1 should exist', function () {
|
||||
expect(window.StatusBar).toBeDefined();
|
||||
});
|
||||
|
||||
it("statusbar.spec.2 should have show|hide methods", function() {
|
||||
it('statusbar.spec.2 should have show|hide methods', function () {
|
||||
expect(window.StatusBar.show).toBeDefined();
|
||||
expect(typeof window.StatusBar.show).toBe("function");
|
||||
expect(typeof window.StatusBar.show).toBe('function');
|
||||
|
||||
expect(window.StatusBar.hide).toBeDefined();
|
||||
expect(typeof window.StatusBar.hide).toBe("function");
|
||||
expect(typeof window.StatusBar.hide).toBe('function');
|
||||
});
|
||||
|
||||
it("statusbar.spec.3 should have set backgroundColor methods", function() {
|
||||
it('statusbar.spec.3 should have set backgroundColor methods', function () {
|
||||
expect(window.StatusBar.backgroundColorByName).toBeDefined();
|
||||
expect(typeof window.StatusBar.backgroundColorByName).toBe("function");
|
||||
expect(typeof window.StatusBar.backgroundColorByName).toBe('function');
|
||||
|
||||
expect(window.StatusBar.backgroundColorByHexString).toBeDefined();
|
||||
expect(typeof window.StatusBar.backgroundColorByHexString).toBe("function");
|
||||
expect(typeof window.StatusBar.backgroundColorByHexString).toBe('function');
|
||||
});
|
||||
|
||||
it("statusbar.spec.4 should have set style methods", function() {
|
||||
it('statusbar.spec.4 should have set style methods', function () {
|
||||
expect(window.StatusBar.styleBlackTranslucent).toBeDefined();
|
||||
expect(typeof window.StatusBar.styleBlackTranslucent).toBe("function");
|
||||
expect(typeof window.StatusBar.styleBlackTranslucent).toBe('function');
|
||||
|
||||
expect(window.StatusBar.styleDefault).toBeDefined();
|
||||
expect(typeof window.StatusBar.styleDefault).toBe("function");
|
||||
expect(typeof window.StatusBar.styleDefault).toBe('function');
|
||||
|
||||
expect(window.StatusBar.styleLightContent).toBeDefined();
|
||||
expect(typeof window.StatusBar.styleLightContent).toBe("function");
|
||||
expect(typeof window.StatusBar.styleLightContent).toBe('function');
|
||||
|
||||
expect(window.StatusBar.styleBlackOpaque).toBeDefined();
|
||||
expect(typeof window.StatusBar.styleBlackOpaque).toBe("function");
|
||||
expect(typeof window.StatusBar.styleBlackOpaque).toBe('function');
|
||||
|
||||
expect(window.StatusBar.overlaysWebView).toBeDefined();
|
||||
expect(typeof window.StatusBar.overlaysWebView).toBe("function");
|
||||
expect(typeof window.StatusBar.overlaysWebView).toBe('function');
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
exports.defineManualTests = function (contentEl, createActionButton) {
|
||||
function log(msg) {
|
||||
var el = document.getElementById("info");
|
||||
function log (msg) {
|
||||
var el = document.getElementById('info');
|
||||
var logLine = document.createElement('div');
|
||||
logLine.innerHTML = msg;
|
||||
el.appendChild(logLine);
|
||||
}
|
||||
|
||||
function doShow() {
|
||||
function doShow () {
|
||||
StatusBar.show();
|
||||
log('StatusBar.isVisible=' + StatusBar.isVisible);
|
||||
}
|
||||
|
||||
function doHide() {
|
||||
function doHide () {
|
||||
StatusBar.hide();
|
||||
log('StatusBar.isVisible=' + StatusBar.isVisible);
|
||||
}
|
||||
|
||||
function doColor1() {
|
||||
function doColor1 () {
|
||||
log('set color=red');
|
||||
StatusBar.backgroundColorByName('red');
|
||||
}
|
||||
|
||||
function doColor2() {
|
||||
function doColor2 () {
|
||||
log('set style=translucent black');
|
||||
StatusBar.styleBlackTranslucent();
|
||||
}
|
||||
|
||||
function doColor3() {
|
||||
function doColor3 () {
|
||||
log('set style=default');
|
||||
StatusBar.styleDefault();
|
||||
}
|
||||
|
||||
var showOverlay = true;
|
||||
function doOverlay() {
|
||||
function doOverlay () {
|
||||
showOverlay = !showOverlay;
|
||||
StatusBar.overlaysWebView(showOverlay);
|
||||
log('Set overlay=' + showOverlay);
|
||||
@@ -105,7 +104,8 @@ exports.defineManualTests = function (contentEl, createActionButton) {
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
contentEl.innerHTML = '<div id="info"></div>' +
|
||||
contentEl.innerHTML =
|
||||
'<div id="info"></div>' +
|
||||
'Also: tapping bar on iOS should emit a log.' +
|
||||
'<div id="action-show"></div>' +
|
||||
'Expected result: Status bar will be visible' +
|
||||
@@ -121,31 +121,59 @@ exports.defineManualTests = function (contentEl, createActionButton) {
|
||||
'Expected result: If overlay false, background color for status bar will be red';
|
||||
|
||||
log('StatusBar.isVisible=' + StatusBar.isVisible);
|
||||
window.addEventListener('statusTap', function () {
|
||||
log('tap!');
|
||||
}, false);
|
||||
window.addEventListener(
|
||||
'statusTap',
|
||||
function () {
|
||||
log('tap!');
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
createActionButton("Show", function () {
|
||||
doShow();
|
||||
}, 'action-show');
|
||||
createActionButton(
|
||||
'Show',
|
||||
function () {
|
||||
doShow();
|
||||
},
|
||||
'action-show'
|
||||
);
|
||||
|
||||
createActionButton("Hide", function () {
|
||||
doHide();
|
||||
}, 'action-hide');
|
||||
createActionButton(
|
||||
'Hide',
|
||||
function () {
|
||||
doHide();
|
||||
},
|
||||
'action-hide'
|
||||
);
|
||||
|
||||
createActionButton("Style=red (background)", function () {
|
||||
doColor1();
|
||||
}, 'action-color1');
|
||||
createActionButton(
|
||||
'Style=red (background)',
|
||||
function () {
|
||||
doColor1();
|
||||
},
|
||||
'action-color1'
|
||||
);
|
||||
|
||||
createActionButton("Style=translucent black", function () {
|
||||
doColor2();
|
||||
}, 'action-color2');
|
||||
createActionButton(
|
||||
'Style=translucent black',
|
||||
function () {
|
||||
doColor2();
|
||||
},
|
||||
'action-color2'
|
||||
);
|
||||
|
||||
createActionButton("Style=default", function () {
|
||||
doColor3();
|
||||
}, 'action-color3');
|
||||
createActionButton(
|
||||
'Style=default',
|
||||
function () {
|
||||
doColor3();
|
||||
},
|
||||
'action-color3'
|
||||
);
|
||||
|
||||
createActionButton("Toggle Overlays", function () {
|
||||
doOverlay();
|
||||
}, 'action-overlays');
|
||||
createActionButton(
|
||||
'Toggle Overlays',
|
||||
function () {
|
||||
doOverlay();
|
||||
},
|
||||
'action-overlays'
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user