Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(872)

Side by Side Diff: test/codegen/expect/lib/html/history_test.js

Issue 2128353002: Check in codegen test expectations. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 dart_library.library('lib/html/history_test', null, /* Imports */[
2 'dart_sdk',
3 'unittest'
4 ], function load__history_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_individual_config = unittest.html_individual_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 src__matcher__throws_matcher = unittest.src__matcher__throws_matcher;
16 const history_test = Object.create(null);
17 let PopStateEventTodynamic = () => (PopStateEventTodynamic = dart.constFn(dart .functionType(dart.dynamic, [html.PopStateEvent])))();
18 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.functionType(dart.void, [])))();
19 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT ype(dart.dynamic, [])))();
20 let VoidTovoid$ = () => (VoidTovoid$ = dart.constFn(dart.definiteFunctionType( dart.void, [])))();
21 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun ctionType(dart.dynamic, [dart.dynamic])))();
22 let const$;
23 history_test.main = function() {
24 html_individual_config.useHtmlIndividualConfiguration();
25 unittest$.group('supported_state', dart.fn(() => {
26 unittest$.test('supportsState', dart.fn(() => {
27 src__matcher__expect.expect(html.History[dartx.supportsState], true);
28 }, VoidTodynamic()));
29 }, VoidTovoid$()));
30 unittest$.group('supported_HashChangeEvent', dart.fn(() => {
31 unittest$.test('supported', dart.fn(() => {
32 src__matcher__expect.expect(html.HashChangeEvent[dartx.supported], true) ;
33 }, VoidTodynamic()));
34 }, VoidTovoid$()));
35 let expectation = dart.test(html.History[dartx.supportsState]) ? src__matche r__core_matchers.returnsNormally : src__matcher__throws_matcher.throws;
36 unittest$.group('history', dart.fn(() => {
37 unittest$.test('pushState', dart.fn(() => {
38 src__matcher__expect.expect(dart.fn(() => {
39 html.window[dartx.history][dartx.pushState](null, html.document[dartx. title], '?dummy');
40 let length = html.window[dartx.history][dartx.length];
41 html.window[dartx.history][dartx.pushState](null, html.document[dartx. title], '?foo=bar');
42 src__matcher__expect.expect(html.window[dartx.location][dartx.href][da rtx.endsWith]('foo=bar'), src__matcher__core_matchers.isTrue);
43 }, VoidTodynamic()), expectation);
44 }, VoidTodynamic()));
45 unittest$.test('pushState with data', dart.fn(() => {
46 src__matcher__expect.expect(dart.fn(() => {
47 html.window[dartx.history][dartx.pushState](dart.map({one: 1}), html.d ocument[dartx.title], '?dummy');
48 src__matcher__expect.expect(html.window[dartx.history][dartx.state], s rc__matcher__core_matchers.equals(dart.map({one: 1})));
49 html.window[dartx.history][dartx.pushState](null, html.document[dartx. title], '?foo=bar');
50 src__matcher__expect.expect(html.window[dartx.location][dartx.href][da rtx.endsWith]('foo=bar'), src__matcher__core_matchers.isTrue);
51 }, VoidTodynamic()), expectation);
52 }, VoidTodynamic()));
53 unittest$.test('back', dart.fn(() => {
54 src__matcher__expect.expect(dart.fn(() => {
55 html.window[dartx.history][dartx.pushState](null, html.document[dartx. title], '?dummy1');
56 html.window[dartx.history][dartx.pushState](null, html.document[dartx. title], '?dummy2');
57 let length = html.window[dartx.history][dartx.length];
58 src__matcher__expect.expect(html.window[dartx.location][dartx.href][da rtx.endsWith]('dummy2'), src__matcher__core_matchers.isTrue);
59 async.Timer.new(const$ || (const$ = dart.const(new core.Duration({mill iseconds: 100}))), VoidTovoid()._check(unittest$.expectAsync(dart.fn(() => {
60 html.window[dartx.onPopState].first.then(dart.dynamic)(PopStateEvent Todynamic()._check(unittest$.expectAsync(dart.fn(_ => {
61 src__matcher__expect.expect(html.window[dartx.history][dartx.lengt h], length);
62 src__matcher__expect.expect(html.window[dartx.location][dartx.href ][dartx.endsWith]('dummy1'), src__matcher__core_matchers.isTrue);
63 }, dynamicTodynamic()))));
64 html.window[dartx.history][dartx.back]();
65 }, VoidTodynamic()))));
66 }, VoidTodynamic()), expectation);
67 }, VoidTodynamic()));
68 unittest$.test('replaceState', dart.fn(() => {
69 src__matcher__expect.expect(dart.fn(() => {
70 let length = html.window[dartx.history][dartx.length];
71 html.window[dartx.history][dartx.replaceState](null, html.document[dar tx.title], '?foo=baz');
72 src__matcher__expect.expect(html.window[dartx.history][dartx.length], length);
73 src__matcher__expect.expect(html.window[dartx.location][dartx.href][da rtx.endsWith]('foo=baz'), src__matcher__core_matchers.isTrue);
74 }, VoidTodynamic()), expectation);
75 }, VoidTodynamic()));
76 unittest$.test('popstatevent', dart.fn(() => {
77 src__matcher__expect.expect(dart.fn(() => {
78 let event = html.Event.eventType('PopStateEvent', 'popstate');
79 src__matcher__expect.expect(html.PopStateEvent.is(event), true);
80 }, VoidTodynamic()), expectation);
81 }, VoidTodynamic()));
82 unittest$.test('hashchangeevent', dart.fn(() => {
83 let expectation = dart.test(html.HashChangeEvent[dartx.supported]) ? src __matcher__core_matchers.returnsNormally : src__matcher__throws_matcher.throws;
84 src__matcher__expect.expect(dart.fn(() => {
85 let event = html.HashChangeEvent.new('change', {oldUrl: 'old', newUrl: 'new'});
86 src__matcher__expect.expect(html.HashChangeEvent.is(event), true);
87 src__matcher__expect.expect(event[dartx.oldUrl], 'old');
88 src__matcher__expect.expect(event[dartx.newUrl], 'new');
89 }, VoidTodynamic()), expectation);
90 }, VoidTodynamic()));
91 }, VoidTovoid$()));
92 };
93 dart.fn(history_test.main, VoidTodynamic());
94 // Exports:
95 exports.history_test = history_test;
96 });
OLDNEW
« no previous file with comments | « test/codegen/expect/lib/html/hidden_dom_2_test.js ('k') | test/codegen/expect/lib/html/htmlcollection_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698