|
1 | 1 | // Checking the colors of the search tab headers.
|
2 |
| -go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html?search=something" |
| 2 | +go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html?search=foo" |
3 | 3 | show-text: true
|
4 | 4 |
|
5 | 5 | define-function: (
|
@@ -74,3 +74,87 @@ call-function: ("check-colors", {
|
74 | 74 | "border_top_selected": "2px solid #0089ff",
|
75 | 75 | "border_top_hover": "2px solid #0089ff",
|
76 | 76 | })
|
| 77 | + |
| 78 | +// set size wide enough that the text is in a single row |
| 79 | +set-window-size: (851, 600) |
| 80 | + |
| 81 | +// Check the size and count in tabs |
| 82 | +assert-text: ("#search-tabs > button:nth-child(1) > .count", " (23)") |
| 83 | +assert-text: ("#search-tabs > button:nth-child(2) > .count", " (4)") |
| 84 | +assert-text: ("#search-tabs > button:nth-child(3) > .count", " (0)") |
| 85 | +store-property: ("#search-tabs > button:nth-child(1)", {"offsetWidth": buttonWidth}) |
| 86 | +assert-property: ("#search-tabs > button:nth-child(2)", {"offsetWidth": |buttonWidth|}) |
| 87 | +assert-property: ("#search-tabs > button:nth-child(3)", {"offsetWidth": |buttonWidth|}) |
| 88 | +store-property: ("#search-tabs > button:nth-child(1) > .count", {"offsetWidth": countWidth}) |
| 89 | +assert-property: ("#search-tabs > button:nth-child(2) > .count", {"offsetWidth": |countWidth|}) |
| 90 | +assert-property: ("#search-tabs > button:nth-child(3) > .count", {"offsetWidth": |countWidth|}) |
| 91 | + |
| 92 | +// Check that counts are in a row with each other |
| 93 | +compare-elements-position: ( |
| 94 | + "#search-tabs > button:nth-child(1) > .count", |
| 95 | + "#search-tabs > button:nth-child(2) > .count", |
| 96 | + ("y") |
| 97 | +) |
| 98 | +compare-elements-position: ( |
| 99 | + "#search-tabs > button:nth-child(2) > .count", |
| 100 | + "#search-tabs > button:nth-child(3) > .count", |
| 101 | + ("y") |
| 102 | +) |
| 103 | +// Check that counts are beside the titles and haven't wrapped |
| 104 | +compare-elements-position-near: ( |
| 105 | + "#search-tabs > button:nth-child(1)", |
| 106 | + "#search-tabs > button:nth-child(1) > .count", |
| 107 | + {"y": 8} |
| 108 | +) |
| 109 | +compare-elements-position-near: ( |
| 110 | + "#search-tabs > button:nth-child(2)", |
| 111 | + "#search-tabs > button:nth-child(2) > .count", |
| 112 | + {"y": 8} |
| 113 | +) |
| 114 | +compare-elements-position-near: ( |
| 115 | + "#search-tabs > button:nth-child(2)", |
| 116 | + "#search-tabs > button:nth-child(2) > .count", |
| 117 | + {"y": 8} |
| 118 | +) |
| 119 | + |
| 120 | +// Set size narrow enough that they wrap. |
| 121 | +// When I tested it, it wrapped at 811px, but I added some fudge factor to ensure it |
| 122 | +// doesn't prematurely wrap with slightly different font kerning or whatever, with a |
| 123 | +// @media query |
| 124 | +set-window-size: (850, 600) |
| 125 | + |
| 126 | +// all counts and buttons still have same size |
| 127 | +store-property: ("#search-tabs > button:nth-child(1)", {"offsetWidth": buttonWidth}) |
| 128 | +assert-property: ("#search-tabs > button:nth-child(2)", {"offsetWidth": |buttonWidth|}) |
| 129 | +assert-property: ("#search-tabs > button:nth-child(3)", {"offsetWidth": |buttonWidth|}) |
| 130 | +store-property: ("#search-tabs > button:nth-child(1) > .count", {"offsetWidth": countWidth}) |
| 131 | +assert-property: ("#search-tabs > button:nth-child(2) > .count", {"offsetWidth": |countWidth|}) |
| 132 | +assert-property: ("#search-tabs > button:nth-child(3) > .count", {"offsetWidth": |countWidth|}) |
| 133 | + |
| 134 | +// Check that counts are still in a row with each other |
| 135 | +compare-elements-position: ( |
| 136 | + "#search-tabs > button:nth-child(1) > .count", |
| 137 | + "#search-tabs > button:nth-child(2) > .count", |
| 138 | + ("y") |
| 139 | +) |
| 140 | +compare-elements-position: ( |
| 141 | + "#search-tabs > button:nth-child(2) > .count", |
| 142 | + "#search-tabs > button:nth-child(3) > .count", |
| 143 | + ("y") |
| 144 | +) |
| 145 | +// Check that counts are NOT beside the titles; now they have wrapped |
| 146 | +compare-elements-position-near-false: ( |
| 147 | + "#search-tabs > button:nth-child(1)", |
| 148 | + "#search-tabs > button:nth-child(1) > .count", |
| 149 | + {"y": 8} |
| 150 | +) |
| 151 | +compare-elements-position-near-false: ( |
| 152 | + "#search-tabs > button:nth-child(2)", |
| 153 | + "#search-tabs > button:nth-child(2) > .count", |
| 154 | + {"y": 8} |
| 155 | +) |
| 156 | +compare-elements-position-near-false: ( |
| 157 | + "#search-tabs > button:nth-child(2)", |
| 158 | + "#search-tabs > button:nth-child(2) > .count", |
| 159 | + {"y": 8} |
| 160 | +) |
0 commit comments