diff --git a/platform/index.d.ts b/platform/index.d.ts index ad6100c707..eed60394f4 100644 --- a/platform/index.d.ts +++ b/platform/index.d.ts @@ -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 // 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; } diff --git a/platform/platform-tests.ts b/platform/platform-tests.ts index 572e85830c..65433ffb13 100644 --- a/platform/platform-tests.ts +++ b/platform/platform-tests.ts @@ -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); - - } }