Skip to content

Commit b10b745

Browse files
committed
feature: @putout/plugin-putout: declare: addAttribute: add
1 parent e913c1e commit b10b745

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

packages/plugin-putout/lib/declare/jsx.spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,14 @@ test('plugin-putout: declare: transform: jsx: hasAttribute', (t) => {
150150
`);
151151
t.end();
152152
});
153+
154+
test('plugin-putout: declare: transform: jsx: addAttribute', (t) => {
155+
t.transformCode(`addAttribute(path, 'data-menu-index', '1')`, montag`
156+
import {operator} from 'putout';
157+
158+
const {addAttribute} = operator;
159+
addAttribute(path, 'data-menu-index', '1');
160+
161+
`);
162+
t.end();
163+
});

packages/plugin-putout/lib/declare/operator/jsx.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export default {
88
removeAttributeValue: 'const {removeAttributeValue} = operator',
99
setAttributeValue: 'const {setAttributeValue} = operator',
1010
addClassName: 'const {addClassName} = operator',
11+
addAttribute: 'const {addAttribute} = operator',
1112
getClassName: 'const {getClassName} = operator',
1213
removeClassName: 'const {removeClassName} = operator',
1314
containsClassName: 'const {containsClassName} = operator',

0 commit comments

Comments
 (0)