Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 618 Bytes

hasStyle.md

File metadata and controls

25 lines (17 loc) · 618 Bytes

hasStyle(style, value)

断言 WrapperArray 中的每一个 Wrapper 的 DOM 节点都有样式的匹配值。

如果 Wrapper 的 DOM 节点有 style 样式值匹配 value 则返回 true

注意:当运行在 jsdom 中的时候只会匹配内联样式。

  • 参数:

    • {string} style
    • {string} value
  • 返回值:{boolean}

  • 示例:

import { mount } from '@vue/test-utils'
import { expect } from 'chai'
import Foo from './Foo.vue'

const wrapper = mount(Foo)
const divArray = wrapper.findAll('div')
expect(divArray.hasStyle('color', 'red')).toBe(true)