All files / runtime/src patchProp.ts

90% Statements 36/40
57.14% Branches 4/7
100% Functions 1/1
90% Lines 36/40

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 411x 1x 1x 1x 1x 1x 1x 53x 53x 53x 53x 53x 53x 53x 53x 53x 53x 53x 53x 53x 53x 35x 35x 35x 53x       53x 53x 13x 13x 53x 5x   5x 5x 5x 53x 53x  
import { isOn } from '@nativescript-vue/shared'
import { patchEvent } from './modules/events'
import { INSVElement } from './nodes'
import { patchClass } from './modules/class'
import { patchStyle } from './modules/style'
import { patchAttr } from './modules/attrs'
 
export function patchProp(
  el: INSVElement,
  key: string,
  prevValue: any,
  nextValue: any,
  isSVG = false,
  prevChildren: any,
  parentComponent: any,
  parentSuspense: any,
  unmountChildren: any
) {
  switch (key) {
    // special
    case 'class':
      // console.log('->patchProp+Class')
      patchClass(el, nextValue)
      break
    case 'style':
      // console.log('->patchProp+Style')
      patchStyle(el, prevValue, nextValue)
      break
    case 'modelValue':
    case 'onUpdate:modelValue':
      // handled by v-model directive
      break
    default:
      if (isOn(key)) {
        patchEvent(el, key, prevValue, nextValue, parentComponent)
      } else {
        patchAttr(el, key, prevValue, nextValue)
      }
  }
}