Browse Source

Add failing test for clearing SelectedText

Deadpikle 5 years ago
parent
commit
d7ca28a443
1 changed files with 18 additions and 0 deletions
  1. 18 0
      tests/Avalonia.Controls.UnitTests/TextBoxTests.cs

+ 18 - 0
tests/Avalonia.Controls.UnitTests/TextBoxTests.cs

@@ -425,6 +425,24 @@ namespace Avalonia.Controls.UnitTests
             }
         }
 
+        [Fact]
+        public void SelectedText_CanClearText()
+        {
+            using (UnitTestApplication.Start(Services))
+            {
+                var target = new TextBox
+                {
+                    Template = CreateTemplate(),
+                    Text = "0123"
+                };
+                target.SelectionStart = 1;
+                target.SelectionEnd = 3;
+                target.SelectedText = "";
+
+                Assert.True(target.Text == "03");
+            }
+        }
+
         [Fact]
         public void CoerceCaretIndex_Doesnt_Cause_Exception_with_malformed_line_ending()
         {