(obj: Record<string, any>, isDynamic = false)
| 66 | } |
| 67 | |
| 68 | function createSlotMatcher(obj: Record<string, any>, isDynamic = false) { |
| 69 | return { |
| 70 | type: NodeTypes.JS_OBJECT_EXPRESSION, |
| 71 | properties: Object.keys(obj) |
| 72 | .map(key => { |
| 73 | return { |
| 74 | type: NodeTypes.JS_PROPERTY, |
| 75 | key: { |
| 76 | type: NodeTypes.SIMPLE_EXPRESSION, |
| 77 | isStatic: !/^\[/.test(key), |
| 78 | content: key.replace(/^\[|\]$/g, ''), |
| 79 | }, |
| 80 | value: obj[key], |
| 81 | } as any |
| 82 | }) |
| 83 | .concat({ |
| 84 | key: { content: `_` }, |
| 85 | value: { |
| 86 | content: isDynamic ? `2 /* DYNAMIC */` : `1 /* STABLE */`, |
| 87 | isStatic: false, |
| 88 | }, |
| 89 | }), |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | describe('compiler: transform component slots', () => { |
| 94 | test('implicit default slot', () => { |
no test coverage detected