Skip to content

Commit

Permalink
Build commit 9cd5890
Browse files Browse the repository at this point in the history
  • Loading branch information
Krinkle committed Jul 11, 2024
1 parent 1a8565a commit 50aa4c6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions api/config/fixture/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link rel="stylesheet" href="/assets/styles.css?v=a2f76041" media="screen">
<link rel="alternate" type="application/rss+xml" href="/feed.xml" title="QUnit">
<title>QUnit.config.fixture | QUnit</title>
<meta property="og:title" content="QUnit.config.fixture"><meta name="description" content="HTML content to render before each test."><meta property="og:description" content="HTML content to render before each test."><link rel="me" href="https://fosstodon.org/@qunit"><meta name="twitter:creator" content="@qunitjs"><meta name="twitter:site" content="@qunitjs"><meta name="twitter:card" content="summary_large_image">
<meta property="og:title" content="QUnit.config.fixture"><meta name="description" content="Clean HTML playground before each test."><meta property="og:description" content="Clean HTML playground before each test."><link rel="me" href="https://fosstodon.org/@qunit"><meta name="twitter:creator" content="@qunitjs"><meta name="twitter:site" content="@qunitjs"><meta name="twitter:card" content="summary_large_image">
<body>
<header class="site-header" role="banner">
<div class="site-header-wrapper wrapper">
Expand Down Expand Up @@ -75,7 +75,7 @@ <h1>QUnit.config.fixture</h1>
<p class="version-details">
version added: <a href="https://github.com/qunitjs/qunit/releases/tag/1.0.0">1.0.0</a><span class="sep">.</span></p>
<h2 id="description" class="screen-reader-text h-api-desc">Description</h2>
<p>In browser environments, this HTML will be rendered in the <code class="language-plaintext highlighter-rouge">#qunit-fixture</code> element before each test.</p>
<p>In browser environments, QUnit can create a safe playground for HTML and DOM manipulation, that is automatically cleaned and restored to the default HTML before each test.</p>

<table>
<tr>
Expand All @@ -90,7 +90,7 @@ <h2 id="description" class="screen-reader-text h-api-desc">Description</h2>

<p>QUnit automatically resets the contents of <code class="language-plaintext highlighter-rouge">&lt;div id="qunit-fixture"&gt;</code>. This gives every test a fresh start, and automatically cleans up any additions or other changes from your tests. As long as you append or insert your elements inside the fixture, you will never have to manually clean up after your tests to keep them atomic.</p>

<p>By starting with an empty fixture in your test HTML file, you effectively give each test a clean start, as QUnit will automatically remove anything that was added there before the next test begins.</p>
<p>By starting with an empty fixture in your test HTML file, you effectively give each test a clean start, as QUnit will automatically remove anything that was added or staged there before the next test begins.</p>

<p>If many of your tests require the same markup, you can also set it inside the fixture ahead of time. This reduces duplication between tests. QUnit guruantees that each test will start with a fresh copy of the original fixture, undoing any changes that happened during any previous tests.</p>

Expand Down Expand Up @@ -123,27 +123,27 @@ <h3 id="automatic-teardown">Automatic teardown</h3>
<span class="nx">QUnit</span><span class="p">.</span><span class="nf">test</span><span class="p">(</span><span class="dl">'</span><span class="s1">example [first]</span><span class="dl">'</span><span class="p">,</span> <span class="nf">function </span><span class="p">(</span><span class="nx">assert</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">const</span> <span class="nx">fixture</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nf">querySelector</span><span class="p">(</span><span class="dl">'</span><span class="s1">#qunit-fixture</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">resultA</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nf">querySelectorAll</span><span class="p">(</span><span class="dl">'</span><span class="s1">#first</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">resultA</span> <span class="o">=</span> <span class="nx">fixture</span><span class="p">.</span><span class="nf">querySelectorAll</span><span class="p">(</span><span class="dl">'</span><span class="s1">.first</span><span class="dl">'</span><span class="p">);</span>
<span class="nx">assert</span><span class="p">.</span><span class="nf">strictEqual</span><span class="p">(</span><span class="nx">resultA</span><span class="p">.</span><span class="nx">length</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="dl">'</span><span class="s1">initial</span><span class="dl">'</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">div</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nf">createElement</span><span class="p">(</span><span class="dl">'</span><span class="s1">div</span><span class="dl">'</span><span class="p">);</span>
<span class="nx">div</span><span class="p">.</span><span class="nx">id</span> <span class="o">=</span> <span class="dl">'</span><span class="s1">first</span><span class="dl">'</span><span class="p">;</span>
<span class="nx">div</span><span class="p">.</span><span class="nx">className</span> <span class="o">=</span> <span class="dl">'</span><span class="s1">first</span><span class="dl">'</span><span class="p">;</span>
<span class="nx">fixture</span><span class="p">.</span><span class="nf">append</span><span class="p">(</span><span class="nx">div</span><span class="p">);</span>

<span class="kd">const</span> <span class="nx">resultB</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nf">querySelectorAll</span><span class="p">(</span><span class="dl">'</span><span class="s1">#first</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">resultB</span> <span class="o">=</span> <span class="nx">fixture</span><span class="p">.</span><span class="nf">querySelectorAll</span><span class="p">(</span><span class="dl">'</span><span class="s1">.first</span><span class="dl">'</span><span class="p">);</span>
<span class="nx">assert</span><span class="p">.</span><span class="nf">strictEqual</span><span class="p">(</span><span class="nx">resultB</span><span class="p">.</span><span class="nx">length</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="dl">'</span><span class="s1">after append</span><span class="dl">'</span><span class="p">);</span>
<span class="p">});</span>

<span class="nx">QUnit</span><span class="p">.</span><span class="nf">test</span><span class="p">(</span><span class="dl">'</span><span class="s1">example [second]</span><span class="dl">'</span><span class="p">,</span> <span class="nf">function </span><span class="p">(</span><span class="nx">assert</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">const</span> <span class="nx">fixture</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nf">querySelector</span><span class="p">(</span><span class="dl">'</span><span class="s1">#qunit-fixture</span><span class="dl">'</span><span class="p">);</span>

<span class="c1">// The previous elements were automatically detached.</span>
<span class="kd">const</span> <span class="nx">result</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nf">querySelectorAll</span><span class="p">(</span><span class="dl">'</span><span class="s1">#first</span><span class="dl">'</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">result</span> <span class="o">=</span> <span class="nx">fixture</span><span class="p">.</span><span class="nf">querySelectorAll</span><span class="p">(</span><span class="dl">'</span><span class="s1">.first</span><span class="dl">'</span><span class="p">);</span>
<span class="nx">assert</span><span class="p">.</span><span class="nf">strictEqual</span><span class="p">(</span><span class="nx">result</span><span class="p">.</span><span class="nx">length</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="dl">'</span><span class="s1">initial is back to zero</span><span class="dl">'</span><span class="p">);</span>
<span class="p">});</span>
</code></pre></div></div>

<h3 id="qunit-fixture-html">qunit-fixture HTML</h3>
<h3 id="default-in-html">default in HTML</h3>

<div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;body&gt;</span>
<span class="nt">&lt;div</span> <span class="na">id=</span><span class="s">"qunit"</span><span class="nt">&gt;&lt;/div&gt;</span>
Expand Down Expand Up @@ -211,7 +211,7 @@ <h3 id="qunit-fixture-html">qunit-fixture HTML</h3>
<span class="p">});</span>
</code></pre></div></div>

<h3 id="dynamic-qunit-fixture">dynamic qunit-fixture</h3>
<h3 id="default-in-javascript">default in JavaScript</h3>

<div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;body&gt;</span>
<span class="nt">&lt;div</span> <span class="na">id=</span><span class="s">"qunit"</span><span class="nt">&gt;&lt;/div&gt;</span>
Expand Down Expand Up @@ -316,7 +316,7 @@ <h4><a href="/api/deprecated/">Deprecated methods</a></h4>

<h4><a href="/api/removed/">Removed methods</a></h4>
<hr><div class="toc-wrapper">
<h4>Table of contents</h4><ol class="toc"><li class="sidebar-item"><a href="#description">Description</a></li><li class="sidebar-item"><a href="#example">Example</a><ol><li class="sidebar-item"><a href="#automatic-teardown">Automatic teardown</a></li><li class="sidebar-item"><a href="#qunit-fixture-html">qunit-fixture HTML</a></li><li class="sidebar-item"><a href="#dynamic-qunit-fixture">dynamic qunit-fixture</a></li></ol></li></ol></div>
<h4>Table of contents</h4><ol class="toc"><li class="sidebar-item"><a href="#description">Description</a></li><li class="sidebar-item"><a href="#example">Example</a><ol><li class="sidebar-item"><a href="#automatic-teardown">Automatic teardown</a></li><li class="sidebar-item"><a href="#default-in-html">default in HTML</a></li><li class="sidebar-item"><a href="#default-in-javascript">default in JavaScript</a></li></ol></li></ol></div>
</aside>

</div>
Expand Down
2 changes: 1 addition & 1 deletion api/config/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ <h2 id="qunit-config-filter"><a href="/api/config/filter/">QUnit.config.filter</
<p>Select tests to run based on a substring or pattern match.</p>

<h2 id="qunit-config-fixture"><a href="/api/config/fixture/">QUnit.config.fixture</a></h2>
<p>HTML content to render before each test.</p>
<p>Clean HTML playground before each test.</p>

<h2 id="qunit-config-hidepassed"><a href="/api/config/hidepassed/">QUnit.config.hidepassed</a></h2>
<p>Hide results of passed tests (HTML Reporter).</p>
Expand Down
2 changes: 1 addition & 1 deletion feed.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><generator uri="https://jekyllrb.com/" version="4.3.3">Jekyll</generator><link href="https://qunitjs.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://qunitjs.com/" rel="alternate" type="text/html" hreflang="en" /><updated>2024-07-11T04:03:14+00:00</updated><id>https://qunitjs.com/feed.xml</id><title type="html">QUnit</title><subtitle>The powerful, easy-to-use JavaScript testing framework.</subtitle></feed>
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><generator uri="https://jekyllrb.com/" version="4.3.3">Jekyll</generator><link href="https://qunitjs.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://qunitjs.com/" rel="alternate" type="text/html" hreflang="en" /><updated>2024-07-11T15:02:42+00:00</updated><id>https://qunitjs.com/feed.xml</id><title type="html">QUnit</title><subtitle>The powerful, easy-to-use JavaScript testing framework.</subtitle></feed>

0 comments on commit 50aa4c6

Please sign in to comment.