Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tarojs/components

Package Overview
Dependencies
Maintainers
2
Versions
951
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tarojs/components - npm Package Compare versions

Comparing version 0.0.36 to 0.0.37

types/Button.d.ts

8

package.json
{
"name": "@tarojs/components",
"version": "0.0.36",
"version": "0.0.37",
"description": "",
"main": "./dist/index.js",
"module": "./src/components/index.js",
"typings": "./types/index.d.ts",
"files": [
"src/components",
"dist",
"utils"
"utils",
"types"
],

@@ -28,5 +30,7 @@ "scripts": {

"dependencies": {
"@types/react": "^16.3.16",
"classnames": "^2.2.5",
"nervjs": "^1.2.16",
"omit.js": "^1.0.0",
"react": "16.3.0",
"weui": "^1.1.2"

@@ -33,0 +37,0 @@ },

@@ -5,2 +5,5 @@ import Nerv from 'nervjs'

const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
const hoverStartTime = 50
const hoverStayTime = 400
describe('View', () => {

@@ -14,21 +17,48 @@ it('render View', () => {

it('touchStart View', () => {
it('should set hoverClass after touchStart and remove it after touchEnd', async () => {
const hoverClass = 'hoverclass'
const onTouchStart = jest.fn()
const view = <View hoverClass='test' onTouchStart={onTouchStart}> hover View</View>
const onTouchEnd = jest.fn()
let viewIns
const view = <View className='class' ref={c => (viewIns = c)} hoverClass={hoverClass} onTouchStart={onTouchStart} onTouchEnd={onTouchEnd}> hover View</View>
const component = renderIntoDocument(view)
const dom = Nerv.findDOMNode(component)
Simulate.touchStart(dom)
expect(onTouchStart).toHaveBeenCalled()
expect(onTouchStart).toHaveBeenCalled()
Simulate.touchEnd(dom)
await delay(hoverStartTime)
expect(dom.getAttribute('class')).not.toContain(hoverClass)
Simulate.touchStart(dom)
await delay(hoverStartTime)
expect(viewIns.state.touch).toEqual(true)
expect(dom.getAttribute('class')).toContain(hoverClass)
Simulate.touchEnd(dom)
expect(onTouchEnd).toHaveBeenCalled()
Simulate.touchStart(dom)
await delay(hoverStayTime)
expect(dom.getAttribute('class')).toContain(hoverClass)
Simulate.touchEnd(dom)
await delay(hoverStayTime)
expect(dom.getAttribute('class')).not.toContain(hoverClass)
})
it('touchEnd View', () => {
const onTouchEnd = jest.fn()
const view = <View hoverClass='test' onTouchEnd={onTouchEnd}> hover View</View>
it('should not execute set hoverClass when hoverClass is undefined', async () => {
let viewIns
const view = <View className='class' ref={c => (viewIns = c)}> hover View</View>
const component = renderIntoDocument(view)
const dom = Nerv.findDOMNode(component)
Simulate.touchStart(dom)
expect(viewIns.state.touch).toEqual(false)
await delay(hoverStartTime)
expect(viewIns.state.hover).toEqual(false)
Simulate.touchEnd(dom)
expect(onTouchEnd).toHaveBeenCalled()
await delay(hoverStayTime)
expect(viewIns.state.hover).toEqual(false)
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc