@@ -96,6 +96,40 @@ public function test_self_closing_tag_with_attributes(): void
9696 );
9797 }
9898
99+ public function test_boolean_attribute_with_self_closing_tag (): void
100+ {
101+ $ code = '<input disabled/> ' ;
102+
103+ $ tokens = new TempestViewLexer ($ code )->lex ();
104+
105+ $ this ->assertTokens (
106+ expected: [
107+ new Token ('<input ' , TokenType::OPEN_TAG_START ),
108+ new Token (' disabled ' , TokenType::ATTRIBUTE_NAME ),
109+ new Token ('/> ' , TokenType::SELF_CLOSING_TAG_END ),
110+ ],
111+ actual: $ tokens ,
112+ );
113+ }
114+
115+ public function test_boolean_attribute_with_newline (): void
116+ {
117+ $ code = '<div hidden
118+ ></div> ' ;
119+
120+ $ tokens = new TempestViewLexer ($ code )->lex ();
121+
122+ $ this ->assertTokens (
123+ expected: [
124+ new Token ('<div ' , TokenType::OPEN_TAG_START ),
125+ new Token (' hidden ' , TokenType::ATTRIBUTE_NAME ),
126+ new Token ("\n> " , TokenType::OPEN_TAG_END ),
127+ new Token ('</div> ' , TokenType::CLOSING_TAG ),
128+ ],
129+ actual: $ tokens ,
130+ );
131+ }
132+
99133 #[TestWith(['</x-foo> ' ])]
100134 public function test_closing_tag (string $ tag ): void
101135 {
@@ -132,9 +166,9 @@ class=', TokenType::ATTRIBUTE_NAME),
132166 foo= ' , TokenType::ATTRIBUTE_NAME ),
133167 new Token ('"bar" ' , TokenType::ATTRIBUTE_VALUE ),
134168 new Token ('
135- x-foo
136- ' , TokenType:: ATTRIBUTE_NAME ),
137- new Token ( ' :baz= ' , TokenType::ATTRIBUTE_NAME ),
169+ x-foo ' , TokenType:: ATTRIBUTE_NAME ),
170+ new Token ( '
171+ :baz= ' , TokenType::ATTRIBUTE_NAME ),
138172 new Token ('"true" ' , TokenType::ATTRIBUTE_VALUE ),
139173 new Token ("\n> " , TokenType::OPEN_TAG_END ),
140174 new Token ('
0 commit comments