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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/assert_selection.js

Issue 2125233003: [Editing][CodeHealth] assert_selection test doesn't need to have element. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.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
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/assert_selection.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7 // This file provides |assert_selection(sample, tester, expectedText)| assertion 7 // This file provides |assert_selection(sample, tester, expectedText)| assertion
8 // to W3C test harness to write editing test cases easier. 8 // to W3C test harness to write editing test cases easier.
9 // 9 //
10 // |sample| is an HTML fragment text which is inserted as |innerHTML|. It should 10 // |sample| is an HTML fragment text which is inserted as |innerHTML|. It should
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 } 502 }
503 503
504 class Sample { 504 class Sample {
505 /** 505 /**
506 * @public 506 * @public
507 * @param {string} sampleText 507 * @param {string} sampleText
508 */ 508 */
509 constructor(sampleText) { 509 constructor(sampleText) {
510 /** @const @type {!HTMLIFame} */ 510 /** @const @type {!HTMLIFame} */
511 this.iframe_ = document.createElement('iframe'); 511 this.iframe_ = document.createElement('iframe');
512 document.body = document.createElement("body");
yosin_UTC9 2016/07/07 05:55:48 Let's check whether |document| has BODY or not to
yoichio 2016/07/07 06:42:07 Done.
512 document.body.appendChild(this.iframe_); 513 document.body.appendChild(this.iframe_);
513 /** @const @type {!HTMLDocument} */ 514 /** @const @type {!HTMLDocument} */
514 this.document_ = this.iframe_.contentDocument; 515 this.document_ = this.iframe_.contentDocument;
515 /** @const @type {!Selection} */ 516 /** @const @type {!Selection} */
516 this.selection_ = this.iframe_.contentWindow.getSelection(); 517 this.selection_ = this.iframe_.contentWindow.getSelection();
517 this.selection_.document = this.document_; 518 this.selection_.document = this.document_;
518 this.selection_.document.offsetLeft = this.iframe_.offsetLeft; 519 this.selection_.document.offsetLeft = this.iframe_.offsetLeft;
519 this.selection_.document.offsetTop = this.iframe_.offsetTop; 520 this.selection_.document.offsetTop = this.iframe_.offsetTop;
520 521
521 this.load(sampleText); 522 this.load(sampleText);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 // case. 653 // case.
653 if (actualText === expectedText) 654 if (actualText === expectedText)
654 sample.remove(); 655 sample.remove();
655 assert_equals(actualText, expectedText, description); 656 assert_equals(actualText, expectedText, description);
656 } 657 }
657 658
658 // Export symbols 659 // Export symbols
659 window.Sample = Sample; 660 window.Sample = Sample;
660 window.assert_selection = assertSelection; 661 window.assert_selection = assertSelection;
661 })(); 662 })();
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/assert_selection.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698