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

Unified Diff: third_party/WebKit/LayoutTests/editing/spelling/spellcheck-marker.html

Issue 2493873002: Introduce Internals#replaceMisspelled() and Internals#setMarker() (Closed)
Patch Set: add layout test Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/editing/spelling/spellcheck-marker.html
diff --git a/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-marker.html b/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-marker.html
new file mode 100644
index 0000000000000000000000000000000000000000..a7d090b16b9fa1047eeada46b48cea1fab7015f3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-marker.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+
+<script src='../../resources/testharness.js'></script>
+<script src='../../resources/testharnessreport.js'></script>
+<script src='../../editing/assert_selection.js'></script>
+<script>
+test(function () {
+ assert_not_equals(window.internals, undefined,
+ 'This test requires internals.');
+ assert_selection(
+ '<div contenteditable="true">^appla| </div>',
yosin_UTC9 2016/11/14 02:28:17 nit: we don't need to have |="true"|
+ selection => {
+ let document = selection.document;
yosin_UTC9 2016/11/14 02:28:17 nit: s/let/const/
+ let begin = selection.anchorOffset;
yosin_UTC9 2016/11/14 02:28:17 nit: s/let/const/ nit: s/begin/start/ We usually
+ let end = selection.focusOffset;
yosin_UTC9 2016/11/14 02:28:17 nit: s/let/const/
+ assert_false(internals.hasSpellingMarker(document, begin, end));
+ internals.setMarker(document, selection.getRangeAt(0), 'Spelling');
+ assert_true(internals.hasSpellingMarker(document, begin, end));
+ internals.replaceMisspelled(document, 'apple');
+ },
+ '<div contenteditable="true">apple| </div>'
+ );
+}, 'test setMarker and replaceMisspelled in internals');
+</script>

Powered by Google App Engine
This is Rietveld 408576698