Skip to content

Commit

Permalink
Fix intermittent tests by cleaning up after each
Browse files Browse the repository at this point in the history
  • Loading branch information
marcotranchino authored and kr8n3r committed Oct 22, 2024
1 parent 11ed1fd commit fe34f32
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion spec/javascripts/table-of-contents-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe('Table of contents', function () {
var $toc
var $closeButton
var $openButton
var $tocStickyHeader
var module

beforeAll(function () {
Expand Down Expand Up @@ -64,13 +65,18 @@ describe('Table of contents', function () {

$closeButton = $toc.find('.js-toc-close')
$openButton = $html.find('.js-toc-show')

$tocStickyHeader = $html.find('.toc-show')
})

afterEach(function () {
// clear up any classes left on <html>
$html.removeClass('.toc-open')
$html.removeClass('toc-open')
$html.find('body #toc-heading').remove()
$html.find('body .toc').remove()
if ($tocStickyHeader && $tocStickyHeader.length) {
$tocStickyHeader.remove()
}
})

describe('when the module is started', function () {
Expand Down

0 comments on commit fe34f32

Please sign in to comment.