OLD | NEW |
(Empty) | |
| 1 dart_library.library('lib/html/blob_constructor_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'unittest' |
| 4 ], function load__blob_constructor_test(exports, dart_sdk, unittest) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const html = dart_sdk.html; |
| 8 const _interceptors = dart_sdk._interceptors; |
| 9 const typed_data = dart_sdk.typed_data; |
| 10 const dart = dart_sdk.dart; |
| 11 const dartx = dart_sdk.dartx; |
| 12 const html_config = unittest.html_config; |
| 13 const unittest$ = unittest.unittest; |
| 14 const src__matcher__expect = unittest.src__matcher__expect; |
| 15 const src__matcher__numeric_matchers = unittest.src__matcher__numeric_matchers
; |
| 16 const blob_constructor_test = Object.create(null); |
| 17 let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSAr
ray$(core.String)))(); |
| 18 let JSArrayOfBlob = () => (JSArrayOfBlob = dart.constFn(_interceptors.JSArray$
(html.Blob)))(); |
| 19 let JSArrayOfByteBuffer = () => (JSArrayOfByteBuffer = dart.constFn(_intercept
ors.JSArray$(typed_data.ByteBuffer)))(); |
| 20 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 21 let dynamicTobool = () => (dynamicTobool = dart.constFn(dart.definiteFunctionT
ype(core.bool, [dart.dynamic])))(); |
| 22 blob_constructor_test.main = function() { |
| 23 html_config.useHtmlConfiguration(); |
| 24 unittest$.test('basic', dart.fn(() => { |
| 25 let b = html.Blob.new([]); |
| 26 src__matcher__expect.expect(b[dartx.size], src__matcher__numeric_matchers.
isZero); |
| 27 }, VoidTodynamic())); |
| 28 unittest$.test('type1', dart.fn(() => { |
| 29 let b = html.Blob.new(JSArrayOfString().of(['Harry']), 'text'); |
| 30 src__matcher__expect.expect(b[dartx.size], 5); |
| 31 src__matcher__expect.expect(b[dartx.type], 'text'); |
| 32 }, VoidTodynamic())); |
| 33 unittest$.test('endings1', dart.fn(() => { |
| 34 let b = html.Blob.new(JSArrayOfString().of(['A\nB\n']), null, 'transparent
'); |
| 35 src__matcher__expect.expect(b[dartx.size], 4); |
| 36 }, VoidTodynamic())); |
| 37 unittest$.test('endings2', dart.fn(() => { |
| 38 let b = html.Blob.new(JSArrayOfString().of(['A\nB\n']), null, 'native'); |
| 39 src__matcher__expect.expect(b[dartx.size], dart.fn(x => dart.equals(x, 4)
|| dart.equals(x, 6), dynamicTobool()), {reason: "b.size should be 4 or 6"}); |
| 40 }, VoidTodynamic())); |
| 41 unittest$.test('twoStrings', dart.fn(() => { |
| 42 let b = html.Blob.new(JSArrayOfString().of(['123', 'xyz']), 'text/plain;ch
arset=UTF-8'); |
| 43 src__matcher__expect.expect(b[dartx.size], 6); |
| 44 }, VoidTodynamic())); |
| 45 unittest$.test('fromBlob1', dart.fn(() => { |
| 46 let b1 = html.Blob.new([]); |
| 47 let b2 = html.Blob.new(JSArrayOfBlob().of([b1])); |
| 48 src__matcher__expect.expect(b2[dartx.size], src__matcher__numeric_matchers
.isZero); |
| 49 }, VoidTodynamic())); |
| 50 unittest$.test('fromBlob2', dart.fn(() => { |
| 51 let b1 = html.Blob.new(JSArrayOfString().of(['x'])); |
| 52 let b2 = html.Blob.new(JSArrayOfBlob().of([b1, b1])); |
| 53 src__matcher__expect.expect(b1[dartx.size], 1); |
| 54 src__matcher__expect.expect(b2[dartx.size], 2); |
| 55 }, VoidTodynamic())); |
| 56 unittest$.test('fromArrayBuffer', dart.fn(() => { |
| 57 let a = typed_data.Uint8List.new(100)[dartx.buffer]; |
| 58 let b = html.Blob.new(JSArrayOfByteBuffer().of([a, a])); |
| 59 src__matcher__expect.expect(b[dartx.size], 200); |
| 60 }, VoidTodynamic())); |
| 61 }; |
| 62 dart.fn(blob_constructor_test.main, VoidTodynamic()); |
| 63 // Exports: |
| 64 exports.blob_constructor_test = blob_constructor_test; |
| 65 }); |
OLD | NEW |