mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 23:37:04 +00:00
Platform — Fixed declarations
This commit is contained in:
Vendored
+4
-5
@@ -1,10 +1,9 @@
|
||||
// Type definitions for Platform 1.0.0
|
||||
// Type definitions for Platform 1.3
|
||||
// Project: https://github.com/bestiejs/platform.js
|
||||
// Definitions by: Jake Hickman <https://github.com/JakeH/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
interface Platform {
|
||||
declare interface Platform {
|
||||
description?: string;
|
||||
layout?: string;
|
||||
manufacturer?: string;
|
||||
@@ -23,9 +22,9 @@ interface Platform {
|
||||
toString?(): string;
|
||||
}
|
||||
|
||||
declare var platform: Platform;
|
||||
|
||||
declare module "platform" {
|
||||
declare var platform: Platform;
|
||||
|
||||
export = platform;
|
||||
}
|
||||
|
||||
|
||||
+14
-20
@@ -1,9 +1,8 @@
|
||||
interface ITestContainer {
|
||||
interface TestContainer {
|
||||
[name: string]: Platform;
|
||||
}
|
||||
|
||||
|
||||
var tests: ITestContainer = {
|
||||
var tests: TestContainer = {
|
||||
'Chrome Mobile 16.0.912.77 on Android 4.0.3': {
|
||||
description: "Chrome Mobile 16.0.912.77 on Android 4.0.3",
|
||||
layout: "WebKit",
|
||||
@@ -45,34 +44,29 @@ function runTests() {
|
||||
var res: boolean;
|
||||
var onFalse: (name: string) => () => any;
|
||||
|
||||
for (var n in tests) {
|
||||
|
||||
for (const [n, value] of Object.entries(tests)) {
|
||||
t = tests[n];
|
||||
p = platform.parse(t.ua);
|
||||
|
||||
|
||||
onFalse = (name: string) => {
|
||||
return () => {
|
||||
console.log('\tfailed on prop "' + name + '" for "' + n + '"');
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
console.log('Starting tests for: ' + n);
|
||||
|
||||
falsy(() => { return t.description === p.description }, onFalse('description'));
|
||||
falsy(() => { return t.layout === p.layout }, onFalse('layout'));
|
||||
falsy(() => { return t.name === p.name }, onFalse('name'));
|
||||
falsy(() => { return t.prerelease === p.prerelease }, onFalse('prerelease'));
|
||||
falsy(() => { return t.ua === p.ua }, onFalse('ua'));
|
||||
falsy(() => { return t.version === p.version }, onFalse('version'));
|
||||
|
||||
falsy(() => { return t.os.architecture === p.os.architecture }, onFalse('os.architecture'));
|
||||
falsy(() => { return t.os.family === p.os.family }, onFalse('os.family'));
|
||||
falsy(() => { return t.os.version === p.os.version }, onFalse('os.version'));
|
||||
falsy(() => t.description === p.description, onFalse('description'));
|
||||
falsy(() => t.layout === p.layout, onFalse('layout'));
|
||||
falsy(() => t.name === p.name, onFalse('name'));
|
||||
falsy(() => t.prerelease === p.prerelease, onFalse('prerelease'));
|
||||
falsy(() => t.ua === p.ua, onFalse('ua'));
|
||||
falsy(() => t.version === p.version, onFalse('version'));
|
||||
falsy(() => t.os.architecture === p.os.architecture, onFalse('os.architecture'));
|
||||
falsy(() => t.os.family === p.os.family, onFalse('os.family'));
|
||||
falsy(() => t.os.version === p.os.version, onFalse('os.version'));
|
||||
|
||||
console.log('Finished tests for: ' + n);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user