From 40c757b0038649b0d18a12b02c30e739348039ae Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Sat, 13 Jun 2020 18:56:59 -0400 Subject: [PATCH] unittest --- dom.d | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/dom.d b/dom.d index 6d45c57..69b24f9 100644 --- a/dom.d +++ b/dom.d @@ -8835,6 +8835,49 @@ unittest { assert(document.querySelector("div:where(.foo)") !is null); } +unittest { +immutable string html = q{ + +
+ + + + + + + + + + + + + + + + + + + + + + + +
Recent Reviews
GameUserRatingCreated
June 13, 2020 15:10[Show]
June 13, 2020 15:02[Show]
June 13, 2020 14:41[Show]
+
+
+}; + + auto doc = new Document(cast(string)html); + // this should select the second table row, but... + auto rd = doc.root.querySelector(`div.roundedbox > table > caption.boxheader + tr + tr + tr > td > a[href^=/reviews/]`); + assert(rd !is null); + assert(rd.href == "/reviews/8832"); + + rd = doc.querySelector(`div.roundedbox > table > caption.boxheader + tr + tr + tr > td > a[href^=/reviews/]`); + assert(rd !is null); + assert(rd.href == "/reviews/8832"); +} + /* Copyright: Adam D. Ruppe, 2010 - 2020 License: Boost License 1.0.