refactor(tests): group test files by feature, drop phase/cluster naming
Restructures the integration test layout so each file is named after
what it covers, not the implementation phase it landed in.
nuwiki-core (renames only):
vimwiki_lexer → lexer
vimwiki_parser → parser
vimwiki_tags → tags
vimwiki_table_alignment → table_alignment
diary_period → diary
list_continuation → lists
transclusion_attrs → transclusion
+ table colspan/rowspan tests moved here from parity_cluster_1
nuwiki-lsp (renames + merges + one split):
cluster_a_list_rewriters → commands_lists
cluster_b_table_rewriters → commands_tables
cluster_c_link_helpers +
phase19_followlink_creates → commands_links
phase13_rename_commands → commands_files
phase17_colorize → commands_colorize
phase17_html_export → html_export
phase15_link_health → link_health
phase18_multi_wiki → multi_wiki
phase19_folding → folding
nav → navigation
lsp_helpers → helpers
phase16_diary +
diary_frequency → diary
phase11_plumbing +
parity_cluster_1 (config) → index_and_config
tags_index_and_lsp +
phase17_backfill → commands_tags
phase14_edit_commands → split into
commands_checkboxes,
commands_headings,
commands_tasks
Net: 30 → 28 integration-test files. 456 → 455 tests (the one
removed test was a dummy `paragraph_render_is_unchanged` whose only
purpose was to keep a `ParagraphNode` import alive in
parity_cluster_1; the import is exercised elsewhere now).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
//! Cluster 7 — Markdown-style alignment markers on the header
|
||||
//! separator row (`|:--|--:|:--:|`) propagate to the AST and HTML.
|
||||
|
||||
use nuwiki_core::ast::{BlockNode, TableAlign};
|
||||
use nuwiki_core::render::{HtmlRenderer, Renderer};
|
||||
use nuwiki_core::syntax::vimwiki::VimwikiSyntax;
|
||||
use nuwiki_core::syntax::SyntaxPlugin;
|
||||
|
||||
fn parse(src: &str) -> nuwiki_core::ast::DocumentNode {
|
||||
VimwikiSyntax::new().parse(src)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn separator_row_with_no_anchors_yields_defaults() {
|
||||
let doc = parse("| h1 | h2 |\n|----|----|\n| a | b |\n");
|
||||
let table = match &doc.children[0] {
|
||||
BlockNode::Table(t) => t,
|
||||
_ => panic!("expected table"),
|
||||
};
|
||||
assert_eq!(
|
||||
table.alignments,
|
||||
vec![TableAlign::Default, TableAlign::Default]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn left_right_center_anchors_parsed() {
|
||||
let doc = parse("| a | b | c |\n|:---|---:|:---:|\n| 1 | 2 | 3 |\n");
|
||||
let table = match &doc.children[0] {
|
||||
BlockNode::Table(t) => t,
|
||||
_ => panic!("expected table"),
|
||||
};
|
||||
assert_eq!(
|
||||
table.alignments,
|
||||
vec![TableAlign::Left, TableAlign::Right, TableAlign::Center]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn html_renderer_emits_text_align_style() {
|
||||
let doc = parse("| a | b | c |\n|:---|---:|:---:|\n| 1 | 2 | 3 |\n");
|
||||
let out = HtmlRenderer::new().render_to_string(&doc).unwrap();
|
||||
assert!(
|
||||
out.contains(r#"<th style="text-align: left;"> a </th>"#),
|
||||
"got: {out}"
|
||||
);
|
||||
assert!(out.contains(r#"<th style="text-align: right;"> b </th>"#));
|
||||
assert!(out.contains(r#"<th style="text-align: center;"> c </th>"#));
|
||||
assert!(out.contains(r#"<td style="text-align: left;"> 1 </td>"#));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn render_without_alignment_omits_style_attr() {
|
||||
let doc = parse("| a | b |\n|---|---|\n| 1 | 2 |\n");
|
||||
let out = HtmlRenderer::new().render_to_string(&doc).unwrap();
|
||||
assert!(!out.contains("text-align"));
|
||||
}
|
||||
Reference in New Issue
Block a user