Skip to content

Commit 28f5ec7

Browse files
1 parent b27f7af commit 28f5ec7

File tree

4 files changed

+205
-216
lines changed

4 files changed

+205
-216
lines changed

misc.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ATTRIBUTE, VALUE } from './expression-types.js'
1+
import { ATTRIBUTE, VALUE, REF } from './expression-types.js'
22
import { dashToCamelCase } from './strings.js'
33

44
/**
@@ -37,6 +37,9 @@ export function evaluateAttributeExpressions(attributes) {
3737
const { value, type } = attribute
3838

3939
switch (true) {
40+
// ref attributes shouldn't be evaluated in the props
41+
case attribute.type === REF:
42+
break
4043
// spread attribute
4144
case !attribute.name && type === ATTRIBUTE:
4245
return {

misc.spec.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { evaluateAttributeExpressions, memoize, panic } from './misc.js'
2-
import { ATTRIBUTE } from './expression-types.js'
2+
import { ATTRIBUTE, REF } from './expression-types.js'
33
import { expect } from 'chai'
44

55
describe('Misc', function () {
@@ -21,6 +21,16 @@ describe('Misc', function () {
2121
})
2222
})
2323

24+
it('evaluateAttributeExpressions (skip ref attributes)', () => {
25+
expect(
26+
evaluateAttributeExpressions([
27+
{
28+
type: REF,
29+
},
30+
]),
31+
).to.be.deep.equal({})
32+
})
33+
2434
it('memoize', () => {
2535
let count = 0 // eslint-disable-line
2636
const increment = memoize(function () {

0 commit comments

Comments
 (0)