File tree Expand file tree Collapse file tree 2 files changed +31
-23
lines changed Expand file tree Collapse file tree 2 files changed +31
-23
lines changed Original file line number Diff line number Diff line change @@ -169,29 +169,6 @@ fn toc_fallback_html() -> Result<Document> {
169
169
Ok ( Document :: from ( html. as_str ( ) ) )
170
170
}
171
171
172
- #[ test]
173
- fn check_first_toc_level ( ) {
174
- let doc = toc_js_html ( ) . unwrap ( ) ;
175
- let mut should_be = Vec :: from ( TOC_TOP_LEVEL ) ;
176
-
177
- should_be. extend ( TOC_SECOND_LEVEL ) ;
178
- should_be. sort_unstable ( ) ;
179
-
180
- let pred = descendants ! (
181
- Class ( "chapter" ) ,
182
- Name ( "li" ) ,
183
- Name ( "a" ) . and( Class ( "toggle" ) . not( ) )
184
- ) ;
185
-
186
- let mut children: Vec < _ > = doc
187
- . find ( pred)
188
- . map ( |elem| elem. text ( ) . trim ( ) . to_string ( ) )
189
- . collect ( ) ;
190
- children. sort ( ) ;
191
-
192
- assert_eq ! ( children, should_be) ;
193
- }
194
-
195
172
#[ test]
196
173
fn check_spacers ( ) {
197
174
let doc = toc_js_html ( ) . unwrap ( ) ;
Original file line number Diff line number Diff line change @@ -4,6 +4,14 @@ use crate::prelude::*;
4
4
use select:: document:: Document ;
5
5
use select:: predicate:: { Class , Name , Predicate } ;
6
6
7
+ const TOC_TOP_LEVEL : & [ & str ] = & [
8
+ "1. With Readme" ,
9
+ "3. Deep Nest 1" ,
10
+ "Prefix 1" ,
11
+ "Prefix 2" ,
12
+ "Suffix 1" ,
13
+ "Suffix 2" ,
14
+ ] ;
7
15
const TOC_SECOND_LEVEL : & [ & str ] = & [
8
16
"1.1. Nested Index" ,
9
17
"1.2. Nested two" ,
@@ -53,3 +61,26 @@ fn check_second_toc_level() {
53
61
54
62
assert_eq ! ( children_of_children, should_be) ;
55
63
}
64
+
65
+ #[ test]
66
+ fn check_first_toc_level ( ) {
67
+ let doc = toc_js_html ( ) ;
68
+ let mut should_be = Vec :: from ( TOC_TOP_LEVEL ) ;
69
+
70
+ should_be. extend ( TOC_SECOND_LEVEL ) ;
71
+ should_be. sort_unstable ( ) ;
72
+
73
+ let pred = descendants ! (
74
+ Class ( "chapter" ) ,
75
+ Name ( "li" ) ,
76
+ Name ( "a" ) . and( Class ( "toggle" ) . not( ) )
77
+ ) ;
78
+
79
+ let mut children: Vec < _ > = doc
80
+ . find ( pred)
81
+ . map ( |elem| elem. text ( ) . trim ( ) . to_string ( ) )
82
+ . collect ( ) ;
83
+ children. sort ( ) ;
84
+
85
+ assert_eq ! ( children, should_be) ;
86
+ }
You can’t perform that action at this time.
0 commit comments