From 6a16b45b63cbeadb6b5c6b7c1cc05aa4e6857dfb Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Thu, 31 Oct 2019 11:48:00 +0700 Subject: [PATCH] feat(web): bounds check unit test --- web/unit_tests/cases/element_interfaces.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/web/unit_tests/cases/element_interfaces.js b/web/unit_tests/cases/element_interfaces.js index 601469a6ba..e1ed36b69c 100644 --- a/web/unit_tests/cases/element_interfaces.js +++ b/web/unit_tests/cases/element_interfaces.js @@ -31,6 +31,7 @@ if(typeof InterfaceTests == 'undefined') { InterfaceTests.Input.resetWithText = function(pair, string) { pair.elem.value = string; + pair.wrapper.invalidateSelection(); pair.elem.setSelectionRange(0, 0); } @@ -76,6 +77,7 @@ if(typeof InterfaceTests == 'undefined') { InterfaceTests.TextArea.resetWithText = function(pair, string) { pair.elem.value = string; + pair.wrapper.invalidateSelection(); pair.elem.setSelectionRange(0, 0); } @@ -803,6 +805,14 @@ if(typeof InterfaceTests == 'undefined') { pair.wrapper.deleteCharsBeforeCaret(2); assert.equal(pair.wrapper.getText(), Apple.mixed.substr(0, 1) + Apple.mixed.substr(4), "Error deleting context chars from a mixed SMP string"); String.kmwEnableSupplementaryPlane(false); + + String.kmwEnableSupplementaryPlane(false); + testObj.resetWithText(pair, Apple.normal); + testObj.setCaret(pair, 4); + pair.wrapper.deleteCharsBeforeCaret(7); + assert.equal(pair.wrapper.getText(), "e", "Bounds-check on deletion range failed; context improperly deleted."); + String.kmwEnableSupplementaryPlane(false); + pair.wrapper.invalidateSelection(); } InterfaceTests.Tests.deleteCharsBeforeCaretWithSelection = function(testObj) {