mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-12 16:44:17 +02:00
Remove explicit use of aria-hidden for offcanvas when closed (#35589)
Remove explicit use of aria-hidden & visibility for offcanvas when closed, handling it with css Co-authored-by: GeoSot <geo.sotis@gmail.com> Co-authored-by: Gaël Poupard <ffoodd@users.noreply.github.com>
This commit is contained in:
@@ -242,23 +242,46 @@ describe('Offcanvas', () => {
|
||||
expect(offCanvas.show).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should call hide method if show class is present', () => {
|
||||
it('should call hide method if show class is present', done => {
|
||||
fixtureEl.innerHTML = '<div class="offcanvas"></div>'
|
||||
|
||||
const offCanvasEl = fixtureEl.querySelector('.offcanvas')
|
||||
const offCanvas = new Offcanvas(offCanvasEl)
|
||||
|
||||
offCanvasEl.addEventListener('shown.bs.offcanvas', () => {
|
||||
expect(offCanvasEl).toHaveClass('show')
|
||||
spyOn(offCanvas, 'hide')
|
||||
|
||||
offCanvas.toggle()
|
||||
|
||||
expect(offCanvas.hide).toHaveBeenCalled()
|
||||
done()
|
||||
})
|
||||
|
||||
offCanvas.show()
|
||||
expect(offCanvasEl).toHaveClass('show')
|
||||
|
||||
spyOn(offCanvas, 'hide')
|
||||
|
||||
offCanvas.toggle()
|
||||
|
||||
expect(offCanvas.hide).toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
describe('show', () => {
|
||||
it('should add `showing` class during opening and `show` class on end', done => {
|
||||
fixtureEl.innerHTML = '<div class="offcanvas"></div>'
|
||||
const offCanvasEl = fixtureEl.querySelector('.offcanvas')
|
||||
const offCanvas = new Offcanvas(offCanvasEl)
|
||||
|
||||
offCanvasEl.addEventListener('show.bs.offcanvas', () => {
|
||||
expect(offCanvasEl).not.toHaveClass('show')
|
||||
})
|
||||
|
||||
offCanvasEl.addEventListener('shown.bs.offcanvas', () => {
|
||||
expect(offCanvasEl).not.toHaveClass('showing')
|
||||
expect(offCanvasEl).toHaveClass('show')
|
||||
done()
|
||||
})
|
||||
|
||||
offCanvas.show()
|
||||
expect(offCanvasEl).toHaveClass('showing')
|
||||
})
|
||||
|
||||
it('should do nothing if already shown', () => {
|
||||
fixtureEl.innerHTML = '<div class="offcanvas show"></div>'
|
||||
|
||||
@@ -353,6 +376,30 @@ describe('Offcanvas', () => {
|
||||
})
|
||||
|
||||
describe('hide', () => {
|
||||
it('should add `hiding` class during closing and remover `show` & `hiding` classes on end', done => {
|
||||
fixtureEl.innerHTML = '<div class="offcanvas"></div>'
|
||||
const offCanvasEl = fixtureEl.querySelector('.offcanvas')
|
||||
const offCanvas = new Offcanvas(offCanvasEl)
|
||||
|
||||
offCanvasEl.addEventListener('hide.bs.offcanvas', () => {
|
||||
expect(offCanvasEl).not.toHaveClass('showing')
|
||||
expect(offCanvasEl).toHaveClass('show')
|
||||
})
|
||||
|
||||
offCanvasEl.addEventListener('hidden.bs.offcanvas', () => {
|
||||
expect(offCanvasEl).not.toHaveClass('hiding')
|
||||
expect(offCanvasEl).not.toHaveClass('show')
|
||||
done()
|
||||
})
|
||||
|
||||
offCanvas.show()
|
||||
offCanvasEl.addEventListener('shown.bs.offcanvas', () => {
|
||||
offCanvas.hide()
|
||||
expect(offCanvasEl).not.toHaveClass('showing')
|
||||
expect(offCanvasEl).toHaveClass('hiding')
|
||||
})
|
||||
})
|
||||
|
||||
it('should do nothing if already shown', () => {
|
||||
fixtureEl.innerHTML = '<div class="offcanvas"></div>'
|
||||
|
||||
|
Reference in New Issue
Block a user