@@ -124,8 +124,8 @@ function shouldSkipFile(fileInfo, config) {
124124 return false ;
125125}
126126
127- function transformAttrs ( tagName , attrs , config ) {
128- return attrs . map ( ( a ) => {
127+ function transformAttrs ( tagName , attrs , nodeParams , config ) {
128+ const newAttrs = attrs . map ( ( a ) => {
129129 let _key = a . key ;
130130 let _valueType = a . value . type ;
131131 let _value ;
@@ -174,6 +174,17 @@ function transformAttrs(tagName, attrs, config) {
174174 }
175175 return b . attr ( _key , _value ) ;
176176 } ) ;
177+
178+ const newValuelessAttrs = nodeParams
179+ . filter ( ( param ) => ! ! param . parts )
180+ . filter ( ( param ) => isAttribute ( param . parts [ 0 ] ) )
181+ . map ( ( param ) => {
182+ const attr = b . attr ( param . parts [ 0 ] , b . text ( '' ) ) ;
183+ attr . isValueless = true ;
184+ return attr ;
185+ } ) ;
186+
187+ return [ ...newAttrs , ...newValuelessAttrs ] ;
177188}
178189
179190function isQueryParam ( param ) {
@@ -299,7 +310,7 @@ function shouldSkipDataTestParams(params, includeValuelessDataTestAttributes) {
299310}
300311
301312function transformNodeAttributes ( tagName , node , config ) {
302- let attributes = transformAttrs ( tagName , node . hash . pairs , config ) ;
313+ let attributes = transformAttrs ( tagName , node . hash . pairs , node . params , config ) ;
303314 return node . params . concat ( attributes ) ;
304315}
305316
@@ -389,7 +400,7 @@ function transformNode(node, fileInfo, config) {
389400 attributes = transformLinkToAttrs ( node . params ) ;
390401 }
391402
392- let namesParams = transformAttrs ( tagName , node . hash . pairs , config ) ;
403+ let namesParams = transformAttrs ( tagName , node . hash . pairs , node . params , config ) ;
393404 attributes = attributes . concat ( namesParams ) ;
394405 } else {
395406 if ( nodeHasPositionalParameters ( node ) ) {
0 commit comments