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

Side by Side Diff: test/codegen/expect/lib/html/element_offset_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/element_offset_test', null, /* Imports */[
2 'dart_sdk',
3 'unittest'
4 ], function load__element_offset_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 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__numeric_matchers = unittest.src__matcher__numeric_matchers ;
15 const element_offset_test = Object.create(null);
16 let JSArrayOfElement = () => (JSArrayOfElement = dart.constFn(_interceptors.JS Array$(html.Element)))();
17 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(da rt.void, [])))();
18 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT ype(dart.dynamic, [])))();
19 element_offset_test.main = function() {
20 html_individual_config.useHtmlIndividualConfiguration();
21 function initPage() {
22 let level1 = html.UListElement.new();
23 level1[dartx.classes].add('level-1');
24 level1[dartx.children][dartx.add]((() => {
25 let _ = html.LIElement.new();
26 _[dartx.innerHtml] = 'I';
27 return _;
28 })());
29 let itemii = html.LIElement.new();
30 itemii[dartx.classes].add('item-ii');
31 itemii[dartx.style][dartx.position] = 'relative';
32 itemii[dartx.style][dartx.top] = '4px';
33 itemii[dartx.innerHtml] = 'II';
34 level1[dartx.children][dartx.add](itemii);
35 let level2 = html.UListElement.new();
36 itemii[dartx.children][dartx.add](level2);
37 let itema = html.LIElement.new();
38 itema[dartx.classes].add('item-a');
39 itema[dartx.innerHtml] = 'A';
40 let item1 = html.LIElement.new();
41 item1[dartx.classes].add('item-1');
42 item1[dartx.innerHtml] = '1';
43 let item2 = html.LIElement.new();
44 item2[dartx.classes].add('item-2');
45 item2[dartx.innerHtml] = '2';
46 let level3 = html.UListElement.new();
47 level3[dartx.children][dartx.addAll](JSArrayOfElement().of([item1, item2]) );
48 let itemb = html.LIElement.new();
49 itemb[dartx.classes].add('item-b');
50 itemb[dartx.style][dartx.position] = 'relative';
51 itemb[dartx.style][dartx.top] = '20px';
52 itemb[dartx.style][dartx.left] = '150px';
53 itemb[dartx.innerHtml] = 'B';
54 itemb[dartx.children][dartx.add](level3);
55 level2[dartx.children][dartx.addAll](JSArrayOfElement().of([itema, itemb, (() => {
56 let _ = html.LIElement.new();
57 _[dartx.innerHtml] = 'C';
58 return _;
59 })()]));
60 html.document[dartx.body][dartx.append](level1);
61 html.document[dartx.body][dartx.style][dartx.whiteSpace] = 'nowrap';
62 let bar = html.DivElement.new();
63 bar[dartx.classes].add('bar');
64 let style = bar[dartx.style];
65 style[dartx.position] = 'absolute';
66 style[dartx.top] = '8px';
67 style[dartx.left] = '90px';
68 let baz = html.DivElement.new();
69 baz[dartx.classes].add('baz');
70 style = baz[dartx.style];
71 style[dartx.position] = 'absolute';
72 style[dartx.top] = '600px';
73 style[dartx.left] = '7000px';
74 bar[dartx.children][dartx.add](baz);
75 let quux = html.DivElement.new();
76 quux[dartx.classes].add('quux');
77 let qux = html.DivElement.new();
78 qux[dartx.classes].add('qux');
79 qux[dartx.children][dartx.add](quux);
80 html.document[dartx.body][dartx.append](bar);
81 html.document[dartx.body][dartx.append](qux);
82 }
83 dart.fn(initPage, VoidTovoid());
84 unittest$.group('offset', dart.fn(() => {
85 unittest$.setUp(initPage);
86 unittest$.test('offsetTo', dart.fn(() => {
87 let itema = html.query('.item-a');
88 let itemb = html.query('.item-b');
89 let item1 = html.query('.item-1');
90 let itemii = html.query('.item-ii');
91 let level1 = html.query('.level-1');
92 let baz = html.query('.baz');
93 let bar = html.query('.bar');
94 let qux = html.query('.qux');
95 let quux = html.query('.quux');
96 let point = itema[dartx.offsetTo](itemii);
97 src__matcher__expect.expect(point.x, 40);
98 src__matcher__expect.expect(point.y, src__matcher__numeric_matchers.inIn clusiveRange(16, 20));
99 src__matcher__expect.expect(baz[dartx.offsetTo](bar).x, 7000);
100 src__matcher__expect.expect(baz[dartx.offsetTo](bar).y, src__matcher__nu meric_matchers.inInclusiveRange(599, 604));
101 qux[dartx.style][dartx.position] = 'fixed';
102 src__matcher__expect.expect(quux[dartx.offsetTo](qux).x, 0);
103 src__matcher__expect.expect(quux[dartx.offsetTo](qux).y, 0);
104 point = item1[dartx.offsetTo](itemb);
105 src__matcher__expect.expect(point.x, 40);
106 src__matcher__expect.expect(point.y, src__matcher__numeric_matchers.inIn clusiveRange(16, 20));
107 point = itemb[dartx.offsetTo](itemii);
108 src__matcher__expect.expect(point.x, 190);
109 src__matcher__expect.expect(point.y, src__matcher__numeric_matchers.inIn clusiveRange(52, 60));
110 point = item1[dartx.offsetTo](itemii);
111 src__matcher__expect.expect(point.x, 230);
112 src__matcher__expect.expect(point.y, src__matcher__numeric_matchers.inIn clusiveRange(68, 80));
113 }, VoidTodynamic()));
114 unittest$.test('documentOffset', dart.fn(() => {
115 let bar = html.query('.bar');
116 let baz = html.query('.baz');
117 let qux = html.query('.qux');
118 let quux = html.query('.quux');
119 let itema = html.query('.item-a');
120 let itemb = html.query('.item-b');
121 let item1 = html.query('.item-1');
122 let itemii = html.query('.item-ii');
123 src__matcher__expect.expect(itema[dartx.documentOffset].x, 88);
124 src__matcher__expect.expect(itema[dartx.documentOffset].y, src__matcher_ _numeric_matchers.inInclusiveRange(111, 160));
125 src__matcher__expect.expect(itemii[dartx.documentOffset].x, 48);
126 src__matcher__expect.expect(itemii[dartx.documentOffset].y, src__matcher __numeric_matchers.inInclusiveRange(95, 145));
127 src__matcher__expect.expect(itemb[dartx.documentOffset].x, 238);
128 src__matcher__expect.expect(itemb[dartx.documentOffset].y, src__matcher_ _numeric_matchers.inInclusiveRange(147, 205));
129 src__matcher__expect.expect(item1[dartx.documentOffset].x, 278);
130 src__matcher__expect.expect(item1[dartx.documentOffset].y, src__matcher_ _numeric_matchers.inInclusiveRange(163, 222));
131 src__matcher__expect.expect(bar[dartx.documentOffset].x, 90);
132 src__matcher__expect.expect(bar[dartx.documentOffset].y, 8);
133 src__matcher__expect.expect(baz[dartx.documentOffset].x, 7090);
134 src__matcher__expect.expect(baz[dartx.documentOffset].y, 608);
135 src__matcher__expect.expect(qux[dartx.documentOffset].x, 8);
136 src__matcher__expect.expect(qux[dartx.documentOffset].y, src__matcher__n umeric_matchers.inInclusiveRange(203, 240));
137 src__matcher__expect.expect(quux[dartx.documentOffset].x, 8);
138 src__matcher__expect.expect(quux[dartx.documentOffset].y, src__matcher__ numeric_matchers.inInclusiveRange(203, 240));
139 }, VoidTodynamic()));
140 }, VoidTovoid()));
141 };
142 dart.fn(element_offset_test.main, VoidTodynamic());
143 // Exports:
144 exports.element_offset_test = element_offset_test;
145 });
OLDNEW
« no previous file with comments | « test/codegen/expect/lib/html/element_dimensions_test.js ('k') | test/codegen/expect/lib/html/element_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698