Skip to content

noUiSlider unit test #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Aug 24, 2016
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/fields/fieldNoUiSlider.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template lang="jade">
div.slider
div.slider(:disabled="disabled")
</template>

<script>
Expand Down
20 changes: 20 additions & 0 deletions test/unit/specs/fields/fieldNoUiSlider.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,25 @@ describe("fieldNoUiSlider.vue", () => {
expect(input).to.be.defined;
expect(input.classList.contains("slider")).to.be.true;
});

before( () => {
vm.$appendTo(document.body);
});

it("should only test in the correct environment", (done) => {
if (window.noUiSlider) {
// make assertions
it("should contain a complex div element", (done) => {
vm.$nextTick( () => {
expect(input).to.be.defined;
expect(input.classList.contains("noui-target")).to.be.true;
done();
});
});

} else {
this.skip();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Travis failed. Missing done()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here, we throw an exception if noUISlider is not loaded instead of skip

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I do something like this ?

if (typeof(window.noUiSlider) === 'object')

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the check is good, but change the this.skip() to throw new Exception("Library is not loaded");

}
});
});
});