@@ -120,28 +120,6 @@ fn entry_ends_with(entry: &DirEntry, ending: &str) -> bool {
120
120
entry. file_name ( ) . to_string_lossy ( ) . ends_with ( ending)
121
121
}
122
122
123
- /// Read the TOC (`book/toc.js`) nested HTML and expose it as a DOM which we
124
- /// can search with the `select` crate
125
- fn toc_js_html ( ) -> Result < Document > {
126
- let temp = DummyBook :: new ( )
127
- . build ( )
128
- . with_context ( || "Couldn't create the dummy book" ) ?;
129
- MDBook :: load ( temp. path ( ) ) ?
130
- . build ( )
131
- . with_context ( || "Book building failed" ) ?;
132
-
133
- let toc_path = temp. path ( ) . join ( "book" ) . join ( "toc.js" ) ;
134
- let html = fs:: read_to_string ( toc_path) . with_context ( || "Unable to read index.html" ) ?;
135
- for line in html. lines ( ) {
136
- if let Some ( left) = line. strip_prefix ( " this.innerHTML = '" ) {
137
- if let Some ( html) = left. strip_suffix ( "';" ) {
138
- return Ok ( Document :: from ( html) ) ;
139
- }
140
- }
141
- }
142
- panic ! ( "cannot find toc in file" )
143
- }
144
-
145
123
/// Read the TOC fallback (`book/toc.html`) HTML and expose it as a DOM which we
146
124
/// can search with the `select` crate
147
125
fn toc_fallback_html ( ) -> Result < Document > {
@@ -157,21 +135,6 @@ fn toc_fallback_html() -> Result<Document> {
157
135
Ok ( Document :: from ( html. as_str ( ) ) )
158
136
}
159
137
160
- // don't use target="_parent" in JS
161
- #[ test]
162
- fn check_link_target_js ( ) {
163
- let doc = toc_js_html ( ) . unwrap ( ) ;
164
-
165
- let num_parent_links = doc
166
- . find (
167
- Class ( "chapter" )
168
- . descendant ( Name ( "li" ) )
169
- . descendant ( Name ( "a" ) . and ( Attr ( "target" , "_parent" ) ) ) ,
170
- )
171
- . count ( ) ;
172
- assert_eq ! ( num_parent_links, 0 ) ;
173
- }
174
-
175
138
// don't use target="_parent" in IFRAME
176
139
#[ test]
177
140
fn check_link_target_fallback ( ) {
0 commit comments