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

alpinejs

Package Overview
Dependencies
Maintainers
1
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alpinejs - npm Package Compare versions

Comparing version 2.3.4 to 2.3.5

2

package.json
{
"main": "dist/alpine.js",
"name": "alpinejs",
"version": "2.3.4",
"version": "2.3.5",
"repository": {

@@ -6,0 +6,0 @@ "type": "git",

@@ -154,3 +154,3 @@

// Otherwise, we can assume x-transition:enter.
} else if (attrs.length > 0) {
} else if (attrs.filter(attr => ['enter', 'enter-start', 'enter-end'].includes(attr.value)).length > 0) {
transitionClassesIn(el, attrs, show)

@@ -180,3 +180,3 @@ } else {

transitionHelperOut(el, modifiers, settingBothSidesOfTransition, hide)
} else if (attrs.length > 0) {
} else if (attrs.filter(attr => ['leave', 'leave-start', 'leave-end'].includes(attr.value)).length > 0) {
transitionClassesOut(el, attrs, hide)

@@ -183,0 +183,0 @@ } else {

import Alpine from 'alpinejs'
import { wait } from '@testing-library/dom'
const timeout = ms => new Promise(resolve => setTimeout(resolve, ms))

@@ -148,2 +149,64 @@ global.MutationObserver = class {

test('if only transition leave directives are present, don\'t transition in at all', async () => {
var frameStack = []
jest.spyOn(window, 'requestAnimationFrame').mockImplementation((callback) => {
frameStack.push(callback)
});
document.body.innerHTML = `
<div x-data="{ show: false }">
<button x-on:click="show = ! show"></button>
<span x-show="show"
x-transition:leave="leave"
x-transition:leave-start="leave-start"
x-transition:leave-end="leave-end"
></span>
</div>
`
Alpine.start()
await wait(() => { expect(document.querySelector('span').getAttribute('style')).toEqual('display: none;') })
document.querySelector('button').click()
await timeout(10)
expect(frameStack.length).toEqual(0)
expect(document.querySelector('span').getAttribute('style')).toEqual(null)
})
test('if only transition enter directives are present, don\'t transition out at all', async () => {
var frameStack = []
jest.spyOn(window, 'requestAnimationFrame').mockImplementation((callback) => {
frameStack.push(callback)
});
document.body.innerHTML = `
<div x-data="{ show: true }">
<button x-on:click="show = ! show"></button>
<span x-show="show"
x-transition:enter="enter"
x-transition:enter-start="enter-start"
x-transition:enter-end="enter-end"
></span>
</div>
`
Alpine.start()
await wait(() => { expect(document.querySelector('span').getAttribute('style')).toEqual(null) })
document.querySelector('button').click()
await timeout(10)
expect(frameStack.length).toEqual(0)
expect(document.querySelector('span').getAttribute('style')).toEqual('display: none;')
})
test('original class attribute classes are preserved after transition finishes', async () => {

@@ -150,0 +213,0 @@ var frameStack = []

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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