Skip to content

Commit

Permalink
V12 Migrate to QUnit2
Browse files Browse the repository at this point in the history
  • Loading branch information
leongersen committed Sep 13, 2018
1 parent a73ccf4 commit 79fbfc2
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 64 deletions.
4 changes: 2 additions & 2 deletions tests/addon_pips.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ QUnit.test("Pips: Positions", function (assert) {

QUnit.test("Pips: Positions, stepped", function (assert) {

expect(0); // TODO
assert.expect(0); // TODO

var slider = test_slider({
mode: 'positions',
Expand Down Expand Up @@ -126,7 +126,7 @@ QUnit.test("Pips: Count, values >= 2", function (assert) {

QUnit.test("Pips: Count, stepped", function (assert) {

expect(0); // TODO
assert.expect(0); // TODO

var slider = test_slider({
mode: 'count',
Expand Down
92 changes: 43 additions & 49 deletions tests/slider.html
Original file line number Diff line number Diff line change
@@ -1,66 +1,60 @@
<!DOCTYPE html>

<head>
<title>Testing</title>
<title>Testing</title>

<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">

<style>
<style>

.noUi-horizontal {
width: 300px;
}
.noUi-vertical {
height: 150px;
}
.noUi-horizontal {
width: 300px;
}

</style>
.noUi-vertical {
height: 150px;
}

<link href="../distribute/nouislider.css" rel="stylesheet">

<link href="https://code.jquery.com/qunit/qunit-1.18.0.css" rel="stylesheet">

<script src="https://code.jquery.com/qunit/qunit-1.18.0.js"></script>
<script src="../node_modules/simulant/dist/simulant.js"></script>
<script>if (window.simulant === undefined) document.write('<script src="https://cdn.rawgit.com/Rich-Harris/simulant/v0.1.4/dist/simulant.js">\x3C/script>');</script>
<script src="../distribute/nouislider.js" data-cover></script>
</style>

<link href="https://code.jquery.com/qunit/qunit-2.6.2.css" rel="stylesheet">
<link href="../distribute/nouislider.css" rel="stylesheet">

<script src="../src/nouislider.js" data-cover></script>

<script src="https://code.jquery.com/qunit/qunit-2.6.2.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jsdom-simulant.umd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/blanket.js/1.1.4/blanket.js"></script>
</head>

<body>

<div id="qunit"></div>
<div id="qunit-fixture"></div>

<script src="range.js"></script>

<script src="slider_values.js"></script>
<script src="slider_limit.js"></script>
<script src="slider_step.js"></script>
<script src="slider_step_margin.js"></script>
<script src="slider_aria.js"></script>
<script src="slider_rtl.js"></script>
<script src="slider_rtl2.js"></script>
<script src="slider_rtl_update_options.js"></script>
<script src="slider_non-linear-rtl.js"></script>
<script src="slider_padding.js"></script>
<script src="slider_setting-getting.js"></script>
<script src="slider_update.js"></script>
<script src="slider_get-step.js"></script>
<script src="slider_unordered.js"></script>
<script src="slider_errors.js"></script>
<script src="slider_binding.js"></script>
<script src="slider_update-numbers.js"></script>
<script src="slider_three_or_more_handles.js"></script>
<script src="slider_contained_handles.js"></script>
<script src="slider_lookaround.js"></script>

<script src="addon_pips.js"></script>
<div id="qunit"></div>
<div id="qunit-fixture"></div>

<script src="range.js"></script>

<script src="slider_values.js"></script>
<script src="slider_limit.js"></script>
<script src="slider_step.js"></script>
<script src="slider_step_margin.js"></script>
<script src="slider_aria.js"></script>
<script src="slider_rtl.js"></script>
<script src="slider_rtl2.js"></script>
<script src="slider_rtl_update_options.js"></script>
<script src="slider_non-linear-rtl.js"></script>
<script src="slider_padding.js"></script>
<script src="slider_setting-getting.js"></script>
<script src="slider_update.js"></script>
<script src="slider_get-step.js"></script>
<script src="slider_unordered.js"></script>
<script src="slider_errors.js"></script>
<script src="slider_binding.js"></script>
<script src="slider_update-numbers.js"></script>
<script src="slider_three_or_more_handles.js"></script>
<script src="slider_contained_handles.js"></script>
<script src="slider_lookaround.js"></script>

<script src="addon_pips.js"></script>

<!-- No blanket.js support in IE < 9 -->
<!--[if gt IE 8]><!-->
<script src="../node_modules/blanket/dist/qunit/blanket.min.js"></script>
<!--<![endif]-->
</body>
12 changes: 6 additions & 6 deletions tests/slider_non-linear-rtl.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ QUnit.test("Testing ltr and rtl non-linear", function (assert) {
}
});

equal(sliderRTL.noUiSlider.get(), '40', 'Start stepping on rtl works');
equal(sliderLTR.noUiSlider.get(), '40', 'Start stepping on ltr works');
assert.equal(sliderRTL.noUiSlider.get(), '40', 'Start stepping on rtl works');
assert.equal(sliderLTR.noUiSlider.get(), '40', 'Start stepping on ltr works');

sliderRTL.noUiSlider.set(42);
sliderLTR.noUiSlider.set(42);

equal(sliderRTL.noUiSlider.get(), '40', 'RTL slider stepped by 10 in upper half.');
equal(sliderLTR.noUiSlider.get(), '40', 'LTR slider stepped by 10 in upper half.');
assert.equal(sliderRTL.noUiSlider.get(), '40', 'RTL slider stepped by 10 in upper half.');
assert.equal(sliderLTR.noUiSlider.get(), '40', 'LTR slider stepped by 10 in upper half.');

sliderRTL.noUiSlider.set(6);
sliderLTR.noUiSlider.set(6);

equal(sliderRTL.noUiSlider.get(), '6', 'RTL slider didn\'t step in lower half.');
equal(sliderLTR.noUiSlider.get(), '6', 'LTR slider didn\'t step in lower half.');
assert.equal(sliderRTL.noUiSlider.get(), '6', 'RTL slider didn\'t step in lower half.');
assert.equal(sliderLTR.noUiSlider.get(), '6', 'LTR slider didn\'t step in lower half.');
});
6 changes: 3 additions & 3 deletions tests/slider_rtl.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ QUnit.test("RTL slider multiple value set.", function (assert) {
}
});

equal(slider.noUiSlider.get(), 0.4);
assert.equal(slider.noUiSlider.get(), 0.4);

slider.noUiSlider.set(0.201);
equal(slider.noUiSlider.get(), 0.2);
assert.equal(slider.noUiSlider.get(), 0.2);

slider.noUiSlider.set(0.201);
equal(slider.noUiSlider.get(), 0.2);
assert.equal(slider.noUiSlider.get(), 0.2);
});
2 changes: 1 addition & 1 deletion tests/slider_step_margin.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
QUnit.test("Margin divisible by step", function (assert) {

expect(0);
assert.expect(0);

document.getElementById('qunit-fixture').innerHTML = '<div class="slider"></div>';

Expand Down
6 changes: 3 additions & 3 deletions tests/slider_unordered.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ QUnit.test("Unordered slider range", function (assert) {
});

slider.noUiSlider.set(11);
equal(slider.noUiSlider.get(), 11);
assert.equal(slider.noUiSlider.get(), 11);

slider.noUiSlider.set(12);
equal(slider.noUiSlider.get(), 12);
assert.equal(slider.noUiSlider.get(), 12);

slider.noUiSlider.set(16);
equal(slider.noUiSlider.get(), 16);
assert.equal(slider.noUiSlider.get(), 16);
});

0 comments on commit 79fbfc2

Please sign in to comment.