[iOS] Multiple links in Mail are dropped in a single line, and are difficult to tell...
[WebKit-https.git] / Tools / TestWebKitAPI / Tests / ios / DataInteractionTests.mm
index 4a348c2..bf0d929 100644 (file)
@@ -856,11 +856,17 @@ TEST(DataInteractionTests, ExternalSourceMultipleURLsToContentEditable)
     [dataInteractionSimulator setExternalItemProviders:@[ firstItem.get(), secondItem.get(), thirdItem.get() ]];
     [dataInteractionSimulator runFrom:CGPointMake(300, 400) to:CGPointMake(100, 300)];
 
-    NSArray *separatedLinks = [[webView stringByEvaluatingJavaScript:@"editor.textContent"] componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
-    EXPECT_EQ(3UL, separatedLinks.count);
-    EXPECT_WK_STREQ("https://www.apple.com/iphone/", separatedLinks[0]);
-    EXPECT_WK_STREQ("https://www.apple.com/mac/", separatedLinks[1]);
-    EXPECT_WK_STREQ("https://webkit.org/", separatedLinks[2]);
+    NSArray *droppedURLs = [webView objectByEvaluatingJavaScript:@"Array.from(editor.querySelectorAll('a')).map(a => a.href)"];
+    EXPECT_EQ(3UL, droppedURLs.count);
+    EXPECT_WK_STREQ("https://www.apple.com/iphone/", droppedURLs[0]);
+    EXPECT_WK_STREQ("https://www.apple.com/mac/", droppedURLs[1]);
+    EXPECT_WK_STREQ("https://webkit.org/", droppedURLs[2]);
+
+    NSArray *linksSeparatedByLine = [[webView objectByEvaluatingJavaScript:@"editor.innerText"] componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];
+    EXPECT_EQ(3UL, linksSeparatedByLine.count);
+    EXPECT_WK_STREQ("https://www.apple.com/iphone/", linksSeparatedByLine[0]);
+    EXPECT_WK_STREQ("https://www.apple.com/mac/", linksSeparatedByLine[1]);
+    EXPECT_WK_STREQ("https://webkit.org/", linksSeparatedByLine[2]);
 }
 
 TEST(DataInteractionTests, RespectsExternalSourceFidelityRankings)
@@ -1466,7 +1472,7 @@ TEST(DataInteractionTests, AdditionalLinkAndImageIntoContentEditable)
         @0.33: [NSValue valueWithCGPoint:CGPointMake(50, 150)],
         @0.66: [NSValue valueWithCGPoint:CGPointMake(50, 250)]
     }];
-    EXPECT_WK_STREQ("ABCD A link", [webView stringByEvaluatingJavaScript:@"editor.textContent"]);
+    EXPECT_WK_STREQ("ABCDA link", [webView stringByEvaluatingJavaScript:@"editor.textContent"]);
     EXPECT_TRUE([webView stringByEvaluatingJavaScript:@"!!editor.querySelector('img')"]);
     EXPECT_WK_STREQ("https://www.apple.com/", [webView stringByEvaluatingJavaScript:@"editor.querySelector('a').href"]);
 }