OLD | NEW |
(Empty) | |
| 1 dart_library.library('lib/html/fontface_loaded_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'unittest' |
| 4 ], function load__fontface_loaded_test(exports, dart_sdk, unittest) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const html = dart_sdk.html; |
| 8 const async = dart_sdk.async; |
| 9 const dart = dart_sdk.dart; |
| 10 const dartx = dart_sdk.dartx; |
| 11 const html_config = unittest.html_config; |
| 12 const unittest$ = unittest.unittest; |
| 13 const src__matcher__expect = unittest.src__matcher__expect; |
| 14 const src__matcher__core_matchers = unittest.src__matcher__core_matchers; |
| 15 const fontface_loaded_test = Object.create(null); |
| 16 let ListTodynamic = () => (ListTodynamic = dart.constFn(dart.functionType(dart
.dynamic, [core.List])))(); |
| 17 let IterableOfFuture = () => (IterableOfFuture = dart.constFn(core.Iterable$(a
sync.Future)))(); |
| 18 let FontFaceAndFontFaceAndFontFaceSetTovoid = () => (FontFaceAndFontFaceAndFon
tFaceSetTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.FontFac
e, html.FontFace, html.FontFaceSet])))(); |
| 19 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun
ctionType(dart.dynamic, [dart.dynamic])))(); |
| 20 let VoidToFuture = () => (VoidToFuture = dart.constFn(dart.definiteFunctionTyp
e(async.Future, [])))(); |
| 21 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 22 fontface_loaded_test.NullTreeSanitizer = class NullTreeSanitizer extends core.
Object { |
| 23 sanitizeTree(node) {} |
| 24 }; |
| 25 fontface_loaded_test.NullTreeSanitizer[dart.implements] = () => [html.NodeTree
Sanitizer]; |
| 26 dart.setSignature(fontface_loaded_test.NullTreeSanitizer, { |
| 27 methods: () => ({sanitizeTree: dart.definiteFunctionType(dart.void, [html.No
de])}) |
| 28 }); |
| 29 fontface_loaded_test.main = function() { |
| 30 html_config.useHtmlConfiguration(); |
| 31 let style = html.Element.html(' <style>\n @font-face {\n fo
nt-family: \'Ahem\';\n src: url(/root_dart/tests/html/Ahem.ttf);\n
font-style: italic;\n font-weight: 300;\n unicode-range: U+0-3FF;
\n font-variant: small-caps;\n -webkit-font-feature-settings: "dli
g" 1;\n /* font-stretch property is not supported */\n }\n </st
yle>\n ', {treeSanitizer: new fontface_loaded_test.NullTreeSanitizer()}); |
| 32 html.document[dartx.head][dartx.append](style); |
| 33 unittest$.test('document fonts - temporary', dart.fn(() => { |
| 34 let atLeastOneFont = false; |
| 35 let loaded = []; |
| 36 html.document[dartx.fonts][dartx.forEach](dart.fn((fontFace, _, __) => { |
| 37 atLeastOneFont = true; |
| 38 let f1 = fontFace[dartx.loaded]; |
| 39 let f2 = fontFace[dartx.loaded]; |
| 40 loaded[dartx.add](fontFace[dartx.load]()); |
| 41 loaded[dartx.add](f1); |
| 42 loaded[dartx.add](f2); |
| 43 }, FontFaceAndFontFaceAndFontFaceSetTovoid())); |
| 44 src__matcher__expect.expect(atLeastOneFont, src__matcher__core_matchers.is
True); |
| 45 return async.Future.wait(dart.dynamic)(IterableOfFuture()._check(loaded)).
then(dart.dynamic)(ListTodynamic()._check(unittest$.expectAsync(dart.fn(_ => { |
| 46 html.document[dartx.fonts][dartx.forEach](dart.fn((fontFace, _, __) => { |
| 47 src__matcher__expect.expect(fontFace[dartx.status], 'loaded'); |
| 48 }, FontFaceAndFontFaceAndFontFaceSetTovoid())); |
| 49 }, dynamicTodynamic())))); |
| 50 }, VoidToFuture())); |
| 51 }; |
| 52 dart.fn(fontface_loaded_test.main, VoidTodynamic()); |
| 53 // Exports: |
| 54 exports.fontface_loaded_test = fontface_loaded_test; |
| 55 }); |
OLD | NEW |