From d0444e65b54c5559c2e5867a2348633f94cbfdf4 Mon Sep 17 00:00:00 2001 From: surunzi Date: Sun, 18 Dec 2016 02:22:38 +0800 Subject: [PATCH] Add: Device info --- src/Info/Info.scss | 10 +++++++++- src/Info/defInfo.es6 | 22 +++++++++++++++++++++- src/Info/info.hbs | 4 ++-- test/info.js | 7 ++++++- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/Info/Info.scss b/src/Info/Info.scss index 1771f4c..4934424 100644 --- a/src/Info/Info.scss +++ b/src/Info/Info.scss @@ -21,7 +21,15 @@ margin: 0; user-select: text; word-break: break-all; + table { + width: 100%; + border-collapse: collapse; + th, td { + border: 1px solid $gray-light; + padding: 10px; + } + } } } } -} } \ No newline at end of file +} } diff --git a/src/Info/defInfo.es6 b/src/Info/defInfo.es6 index 33de883..8029132 100644 --- a/src/Info/defInfo.es6 +++ b/src/Info/defInfo.es6 @@ -6,5 +6,25 @@ export default [ { name: 'User Agent', val: navigator.userAgent + }, + { + name: 'Device', + val: ` + + + + + + + + + + + + + + +
screen${screen.width}px * ${screen.height}px
viewport${window.innerWidth}px * ${window.innerHeight}px
pixel ratio${window.devicePixelRatio}
` + } -]; \ No newline at end of file +]; diff --git a/src/Info/info.hbs b/src/Info/info.hbs index dfd01fd..6a64c23 100644 --- a/src/Info/info.hbs +++ b/src/Info/info.hbs @@ -2,7 +2,7 @@ {{#each messages}}
  • {{name}}

    -

    {{val}}

    +
    {{{val}}}
  • {{/each}} - \ No newline at end of file + diff --git a/test/info.js b/test/info.js index c3c7254..aef5ec1 100644 --- a/test/info.js +++ b/test/info.js @@ -12,6 +12,11 @@ describe('default', function () { expect($tool.find('.eruda-content').eq(1)).toContainText(navigator.userAgent); }); + + it('device', function () + { + expect($tool.find('.eruda-content').eq(2)).toContainText(window.innerWidth); + }); }); describe('basic', function () @@ -34,4 +39,4 @@ describe('basic', function () tool.remove('test'); expect($tool.find('li')).toHaveLength(0); }); -}); \ No newline at end of file +});