Skip to content

Commit 2d5926f

Browse files
committed
fix more sessionStorage from localStorage
1 parent 83346ed commit 2d5926f

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

test/attributes/hx-history-elt.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ describe('hx-history attribute', function() {
44
beforeEach(function() {
55
this.server = makeServer()
66
clearWorkArea()
7-
localStorage.removeItem(HTMX_HISTORY_CACHE_NAME)
7+
sessionStorage.removeItem(HTMX_HISTORY_CACHE_NAME)
88
})
99
afterEach(function() {
1010
this.server.restore()
1111
clearWorkArea()
12-
localStorage.removeItem(HTMX_HISTORY_CACHE_NAME)
12+
sessionStorage.removeItem(HTMX_HISTORY_CACHE_NAME)
1313
})
1414

1515
it('content of hx-history-elt is used during history replacment', function() {
@@ -29,7 +29,7 @@ describe('hx-history attribute', function() {
2929

3030
this.server.respondWith('GET', '/test1', '<div>content outside of hx-history-elt not included</div><div id="work-area" hx-history-elt><div id="d2" hx-push-url="true" hx-get="/test2" hx-swap="outerHTML settle:0">test3</div></div>')
3131
// clear cache so it makes a full page request on history restore
32-
localStorage.removeItem(HTMX_HISTORY_CACHE_NAME)
32+
sessionStorage.removeItem(HTMX_HISTORY_CACHE_NAME)
3333

3434
htmx._('restoreHistory')('/test1')
3535
this.server.respond()

test/core/events.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ describe('Core htmx Events', function() {
741741
})
742742

743743
it('preventDefault() in htmx:historyCacheMiss stops the history request', function() {
744-
localStorage.removeItem(HTMX_HISTORY_CACHE_NAME)
744+
sessionStorage.removeItem(HTMX_HISTORY_CACHE_NAME)
745745
var handler = htmx.on('htmx:historyCacheMiss', function(evt) {
746746
evt.preventDefault()
747747
})
@@ -760,7 +760,7 @@ describe('Core htmx Events', function() {
760760
this.server.respond()
761761
workArea.textContent.should.equal('test2')
762762

763-
localStorage.removeItem(HTMX_HISTORY_CACHE_NAME) // clear cache
763+
sessionStorage.removeItem(HTMX_HISTORY_CACHE_NAME) // clear cache
764764
htmx._('restoreHistory')('/test1')
765765
this.server.respond()
766766
getWorkArea().textContent.should.equal('test2')
@@ -770,7 +770,7 @@ describe('Core htmx Events', function() {
770770
})
771771

772772
it('htmx:historyCacheMissLoad event can update history swap', function() {
773-
localStorage.removeItem(HTMX_HISTORY_CACHE_NAME)
773+
sessionStorage.removeItem(HTMX_HISTORY_CACHE_NAME)
774774
var handler = htmx.on('htmx:historyCacheMissLoad', function(evt) {
775775
evt.detail.historyElt = byId('hist-re-target')
776776
evt.detail.swapSpec.swapStyle = 'outerHTML'
@@ -793,7 +793,7 @@ describe('Core htmx Events', function() {
793793
this.server.respond()
794794
workArea.textContent.should.equal('test2')
795795

796-
localStorage.removeItem(HTMX_HISTORY_CACHE_NAME) // clear cache
796+
sessionStorage.removeItem(HTMX_HISTORY_CACHE_NAME) // clear cache
797797
htmx._('restoreHistory')('/test1')
798798
this.server.respond()
799799
getWorkArea().textContent.should.equal('test2Updated')
@@ -805,7 +805,7 @@ describe('Core htmx Events', function() {
805805
})
806806

807807
it('htmx:historyCacheMiss event can set custom request headers', function() {
808-
localStorage.removeItem(HTMX_HISTORY_CACHE_NAME)
808+
sessionStorage.removeItem(HTMX_HISTORY_CACHE_NAME)
809809
var handler = htmx.on('htmx:historyCacheMiss', function(evt) {
810810
evt.detail.xhr.setRequestHeader('CustomHeader', 'true')
811811
})
@@ -816,7 +816,7 @@ describe('Core htmx Events', function() {
816816
make('<div id="d1" hx-push-url="true" hx-get="/test1" hx-swap="outerHTML settle:0">init</div>')
817817

818818
try {
819-
localStorage.removeItem(HTMX_HISTORY_CACHE_NAME) // clear cache
819+
sessionStorage.removeItem(HTMX_HISTORY_CACHE_NAME) // clear cache
820820
htmx._('restoreHistory')('/test1')
821821
this.server.respond()
822822
getWorkArea().textContent.should.equal('test1')
@@ -826,7 +826,7 @@ describe('Core htmx Events', function() {
826826
})
827827

828828
it('preventDefault() in htmx:historyCacheHit stops the history action', function() {
829-
localStorage.removeItem(HTMX_HISTORY_CACHE_NAME)
829+
sessionStorage.removeItem(HTMX_HISTORY_CACHE_NAME)
830830
var handler = htmx.on('htmx:historyCacheHit', function(evt) {
831831
evt.preventDefault()
832832
})
@@ -853,7 +853,7 @@ describe('Core htmx Events', function() {
853853
})
854854

855855
it('htmx:historyCacheHit event can update history swap', function() {
856-
localStorage.removeItem(HTMX_HISTORY_CACHE_NAME)
856+
sessionStorage.removeItem(HTMX_HISTORY_CACHE_NAME)
857857
var handler = htmx.on('htmx:historyCacheHit', function(evt) {
858858
evt.detail.historyElt = byId('hist-re-target')
859859
evt.detail.swapSpec.swapStyle = 'outerHTML'

0 commit comments

Comments
 (0)