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

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

Issue 2105663002: [Editing][Codehealth] Rewrite user-select-all-selection.html with assert_selection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update 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 | « no previous file | third_party/WebKit/LayoutTests/editing/selection/user-select-all-selection.html » ('j') | 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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.appendChild(this.iframe_); 512 document.body.appendChild(this.iframe_);
513 /** @const @type {!HTMLDocument} */ 513 /** @const @type {!HTMLDocument} */
514 this.document_ = this.iframe_.contentDocument; 514 this.document_ = this.iframe_.contentDocument;
515 /** @const @type {!Selection} */ 515 /** @const @type {!Selection} */
516 this.selection_ = this.iframe_.contentWindow.getSelection(); 516 this.selection_ = this.iframe_.contentWindow.getSelection();
517 this.selection_.document = this.document_; 517 this.selection_.document = this.document_;
518 this.selection_.document.offsetLeft = this.iframe_.offsetLeft;
519 this.selection_.document.offsetTop = this.iframe_.offsetTop;
518 520
519 this.load(sampleText); 521 this.load(sampleText);
520 } 522 }
521 523
522 /** @return {!HTMLDocument} */ 524 /** @return {!HTMLDocument} */
523 get document() { return this.document_; } 525 get document() { return this.document_; }
524 526
525 /** @return {!Selection} */ 527 /** @return {!Selection} */
526 get selection() { return this.selection_; } 528 get selection() { return this.selection_; }
527 529
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 // case. 652 // case.
651 if (actualText === expectedText) 653 if (actualText === expectedText)
652 sample.remove(); 654 sample.remove();
653 assert_equals(actualText, expectedText, description); 655 assert_equals(actualText, expectedText, description);
654 } 656 }
655 657
656 // Export symbols 658 // Export symbols
657 window.Sample = Sample; 659 window.Sample = Sample;
658 window.assert_selection = assertSelection; 660 window.assert_selection = assertSelection;
659 })(); 661 })();
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/selection/user-select-all-selection.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698