OLD | NEW |
(Empty) | |
| 1 dart_library.library('lib/html/storage_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'unittest' |
| 4 ], function load__storage_test(exports, dart_sdk, unittest) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const html = dart_sdk.html; |
| 8 const dart = dart_sdk.dart; |
| 9 const dartx = dart_sdk.dartx; |
| 10 const html_config = unittest.html_config; |
| 11 const unittest$ = unittest.unittest; |
| 12 const src__matcher__expect = unittest.src__matcher__expect; |
| 13 const src__matcher__core_matchers = unittest.src__matcher__core_matchers; |
| 14 const storage_test = Object.create(null); |
| 15 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 16 storage_test.main = function() { |
| 17 html_config.useHtmlConfiguration(); |
| 18 unittest$.test('GetItem', dart.fn(() => { |
| 19 let value = html.window[dartx.localStorage][dartx.get]('does not exist'); |
| 20 src__matcher__expect.expect(value, src__matcher__core_matchers.isNull); |
| 21 }, VoidTodynamic())); |
| 22 unittest$.test('SetItem', dart.fn(() => { |
| 23 let key = 'foo'; |
| 24 let value = 'bar'; |
| 25 html.window[dartx.localStorage][dartx.set](key, value); |
| 26 let stored = html.window[dartx.localStorage][dartx.get](key); |
| 27 src__matcher__expect.expect(stored, value); |
| 28 }, VoidTodynamic())); |
| 29 unittest$.test('event', dart.fn(() => { |
| 30 let event = html.StorageEvent.new('something', {oldValue: 'old', newValue:
'new', url: 'url', key: 'key'}); |
| 31 src__matcher__expect.expect(html.StorageEvent.is(event), src__matcher__cor
e_matchers.isTrue); |
| 32 src__matcher__expect.expect(event[dartx.oldValue], 'old'); |
| 33 src__matcher__expect.expect(event[dartx.newValue], 'new'); |
| 34 }, VoidTodynamic())); |
| 35 }; |
| 36 dart.fn(storage_test.main, VoidTodynamic()); |
| 37 // Exports: |
| 38 exports.storage_test = storage_test; |
| 39 }); |
OLD | NEW |