Skip to content

Commit 84306cc

Browse files
Fix non chrome view transtions tests (#3338)
fix non chrome view transitions tests
1 parent 3f49db3 commit 84306cc

2 files changed

Lines changed: 27 additions & 25 deletions

File tree

test/attributes/hx-swap.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -311,20 +311,21 @@ describe('hx-swap attribute', function() {
311311
done()
312312
})
313313

314-
it('works with transition:true', function(done) {
315-
this.server.respondWith('GET', '/test', 'Clicked!')
316-
var div = make(
317-
"<div hx-get='/test' hx-swap='innerHTML transition:true'></div>"
318-
)
319-
div.click()
320-
this.server.respond()
321-
div.innerText.should.equal('')
322-
setTimeout(function() {
323-
div.innerText.should.equal('Clicked!')
324-
done()
325-
}, 30)
326-
})
327-
314+
if (/chrome/i.test(navigator.userAgent)) {
315+
it('works with transition:true', function(done) {
316+
this.server.respondWith('GET', '/test', 'Clicked!')
317+
var div = make(
318+
"<div hx-get='/test' hx-swap='innerHTML transition:true'></div>"
319+
)
320+
div.click()
321+
this.server.respond()
322+
div.innerText.should.equal('')
323+
setTimeout(function() {
324+
div.innerText.should.equal('Clicked!')
325+
done()
326+
}, 50)
327+
})
328+
}
328329
it('works with a settle delay', function(done) {
329330
this.server.respondWith('GET', '/test', "<div id='d1' class='foo' hx-get='/test' hx-swap='outerHTML settle:10ms'></div>")
330331
var div = make("<div id='d1' hx-get='/test' hx-swap='outerHTML settle:10ms'></div>")

test/core/api.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -494,17 +494,18 @@ describe('Core htmx API test', function() {
494494
}, 30)
495495
})
496496

497-
it('swap works with a view transition', function(done) {
498-
var div = make("<div hx-get='/test'></div>")
499-
div.innerText.should.equal('')
500-
htmx.swap(div, 'jsswapped', { transition: true })
501-
div.innerText.should.equal('')
502-
setTimeout(function() {
503-
div.innerText.should.equal('jsswapped')
504-
done()
505-
}, 30)
506-
})
507-
497+
if (/chrome/i.test(navigator.userAgent)) {
498+
it('swap works with a view transition', function(done) {
499+
var div = make("<div hx-get='/test'></div>")
500+
div.innerText.should.equal('')
501+
htmx.swap(div, 'jsswapped', { transition: true })
502+
div.innerText.should.equal('')
503+
setTimeout(function() {
504+
div.innerText.should.equal('jsswapped')
505+
done()
506+
}, 50)
507+
})
508+
}
508509
it('swaps content properly (with select)', function() {
509510
var output = make('<output id="output"/>')
510511
htmx.swap('#output', '<div><p id="select-me">Swapped!</p></div>', { swapStyle: 'innerHTML' }, { select: '#select-me' })

0 commit comments

Comments
 (0)