Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .entire/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ tmp/
settings.local.json
metadata/
logs/
.crush/logs
.entire/metadata/
64 changes: 0 additions & 64 deletions KNOWN_ISSUES.md

This file was deleted.

29 changes: 19 additions & 10 deletions internal/codeformatter/css_selector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ import (
)

func TestApplyCSSSelector(t *testing.T) {
// TODO: Fix these tests - they're failing due to newline formatting issues
// and incomplete CSS selector support
t.Skip("Skipping test: known issue with CSS selector formatting")
tests := []struct {
name string
html string
Expand All @@ -22,7 +19,7 @@ func TestApplyCSSSelector(t *testing.T) {
name: "Element selector - find all divs",
html: `<div class="a">First</div><div class="b">Second</div>`,
selector: "div",
want: `<div class="a">First</div>\n<div class="b">Second</div>`,
want: "<div class=\"a\">First</div>\n<div class=\"b\">Second</div>",
},
{
name: "Class selector - find by class",
Expand Down Expand Up @@ -61,13 +58,13 @@ func TestApplyCSSSelector(t *testing.T) {
<article class="post"><h2>Post 2</h2></article>
</body></html>`,
selector: "article",
want: `<article class="post"><h2>Post 1</h2></article>\n<article class="post"><h2>Post 2</h2></article>`,
want: "<article class=\"post\"><h2>Post 1</h2></article>\n<article class=\"post\"><h2>Post 2</h2></article>",
},
{
name: "No html/body wrapper - elements extracted directly",
html: `<genre>Computer</genre><genre>Tech</genre>`,
selector: "genre",
want: `<genre>Computer</genre>\n<genre>Tech</genre>`,
want: "<genre>Computer</genre>\n<genre>Tech</genre>",
},
{
name: "No matching elements",
Expand Down Expand Up @@ -162,14 +159,26 @@ func TestFindElementByID(t *testing.T) {
}

func TestFindElementsByDescendant(t *testing.T) {
// TODO: Fix this test - CSS selector implementation incomplete
t.Skip("Skipping test: known issue with CSS selector descendant implementation")
html := `<div class="container"><h1>Title</h1><p>Text</p><div class="inner"><h1>Inner Title</h1></div></div>`
doc := parseHTML(t, html)

// Test element with class selector
results := findElementsByDescendant(doc, "div.container > h1")
if len(results) != 1 {
t.Errorf("Expected 1 h1 inside div.container, got %d", len(results))
}

// Test simple tag selector at end
results = findElementsByDescendant(doc, "div h1")
if len(results) != 2 {
t.Errorf("Expected 2 h1 elements inside div, got %d", len(results))
}
}

// Helper function to parse HTML for testing
func parseHTML(t *testing.T, htmlStr string) *html.Node {
func parseHTML(t *testing.T, htmlContent string) *html.Node {
t.Helper()
doc, err := html.Parse(strings.NewReader(htmlStr))
doc, err := html.Parse(strings.NewReader(htmlContent))
if err != nil {
t.Fatalf("Failed to parse HTML: %v", err)
}
Expand Down
Loading