# frozen_string_literal: true require_relative "../test_helper" module Parser class CommentsTest < Minitest::Spec include SnapshotUtils test "HTML comment with padding whitespace" do assert_parsed_snapshot(%()) end test "HTML comment with no whitespace" do assert_parsed_snapshot(%()) end test "HTML comment followed by html tag" do assert_parsed_snapshot(%(

Hello

)) end test "HTML comment followed by html tag with nested comment" do assert_parsed_snapshot(%(

)) end test "HTML comment with if" do assert_parsed_snapshot(<<~HTML) HTML end test "HTML comment with invalid closing tag --!>" do assert_parsed_snapshot(%()) end test "HTML comment with invalid closing tag --!> no whitespace" do assert_parsed_snapshot(%()) end test "HTML comment with invalid closing tag --!> followed by html tag" do assert_parsed_snapshot(%(

Hello

)) end test "unclosed HTML comment" do assert_parsed_snapshot(%( c -->) assert_parsed_snapshot(template, strict: true) assert_parsed_snapshot(template, strict: false) end test "nested HTML comment opener in an unclosed comment" do template = %()) end test "nested HTML comment opener at end of file" do assert_parsed_snapshot(%() assert_parsed_snapshot(template, strict: true) assert_parsed_snapshot(template, strict: false) end end end