Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
test(components): add some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanfoster committed Aug 10, 2016
1 parent 9af1992 commit b7f4b63
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/integration/components/em-flickity-test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,47 @@
/* jshint expr:true */
import { expect } from "chai";
import { describeComponent, it } from "ember-mocha";
import { describe } from "mocha";
import hbs from "htmlbars-inline-precompile";

const NEXT_BUTTON = ".flickity-prev-next-button.next";
const PREV_BUTTON = ".flickity-prev-next-button.previous";
const PAGE_DOTS = ".flickity-page-dots";

describeComponent("em-flickity", "Integration: EmFlickityComponent", {
integration: true
}, function () {
it("renders", function () {
this.render(hbs`{{em-flickity}}`);
expect(this.$()).to.have.length(1);
});

describe("showSlides", function () {
it("hides flickity controls if false", function () {
this.render(hbs`{{em-flickity}}`);

expect(this.$(NEXT_BUTTON)).to.have.length(0);
expect(this.$(PREV_BUTTON)).to.have.length(0);
});

it("shows flickity controls if true", function () {
this.render(hbs`
{{#em-flickity showSlides=true}}
<div id="slide-1"></div>
<div id="slide-2"></div>
{{/em-flickity}}
`);

expect(this.$(NEXT_BUTTON)).to.have.length(1);
});
});

it("passes options to flickity", function () {
this.render(hbs`
{{#em-flickity pageDots=true showSlides=true}}
{{/em-flickity}}
`);

expect(this.$(PAGE_DOTS)).to.have.length(1);
});
});

0 comments on commit b7f4b63

Please sign in to comment.