Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thostetler committed Oct 25, 2018
1 parent edc495b commit 3b2bfb3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions test/mocha/js/widgets/list_of_things_widget.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ define(['marionette',
) {

describe("ListOfThings (list_of_things_widget.spec.js)", function () {

// on slower machines 20000 default is not enough
this.timeout(40000);

beforeEach(function () {
this.sb = sinon.sandbox.create();
})
Expand Down Expand Up @@ -237,7 +237,7 @@ define(['marionette',
// give command to display first 20 docs; since responses are coming in
// batches of 10; the collection will automatically ask twice
minsub.publish(minsub.DISPLAY_DOCUMENTS, new ApiQuery({'q': 'bibcode:bar'}));
expect($w.find("label").length).to.equal(50);
expect($w.find("label").length).to.equal(51);
expect($(".s-checkbox-col").text().replace(/\s+/g, " ")).to.eql(" 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 ")

// click on next page // this should trigger new request
Expand Down Expand Up @@ -305,7 +305,7 @@ define(['marionette',

// model should update, and reset page back to 0
expect(widget.model.get("perPage")).to.eql(50);
expect($(".per-page--active").text().trim()).to.eql("50");
expect($("#per-page-select>option:selected").text().trim()).to.eql("50");
expect($("input.page-control").val()).to.eql("1");


Expand All @@ -316,10 +316,10 @@ define(['marionette',

widget.trigger("pagination:changePerPage", 50);
expect(widget.model.get("perPage")).to.eql(50);

expect(JSON.stringify(widget.model.toJSON())).to.eql('{"mainResults":false,"showAbstract":"closed","showHighlights":false,"pagination":true,"start":0,"perPage":50,"numFound":100,"currentQuery":{"q":["foo:bar"]},"pageData":{"perPage":50,"totalPages":2,"currentPage":1,"previousPossible":false,"nextPossible":true},"page":0,"showRange":[0,49],"query":false,"loading":false}');

expect($(".per-page--active").text().trim()).to.eql("50");
expect($("#per-page-select>option:selected").text().trim()).to.eql("50");
expect($("input.page-control").val()).to.eql("1");

expect($(".page-control.previous-page").parent().hasClass("disabled")).to.be.true;
Expand Down Expand Up @@ -382,7 +382,7 @@ define(['marionette',

widget.updatePagination({ page : 2 , perPage : 25});

expect($(".per-page--active").text().trim()).to.eql("25");
expect($("#per-page-select>option:selected").text().trim()).to.eql("25");
expect($("input.page-control").val()).to.eql("3");

expect($(".page-control.previous-page").parent().hasClass("disabled")).to.be.false;
Expand All @@ -400,7 +400,7 @@ define(['marionette',
expect($(".page-control.previous-page").parent().hasClass("disabled")).to.be.false;
expect($(".page-control.next-page").parent().hasClass("disabled")).to.be.true;

expect($(".per-page--active").text().trim()).to.eql("25");
expect($("#per-page-select>option:selected").text().trim()).to.eql("25");
expect($("input.page-control").val()).to.eql("4");


Expand Down
8 changes: 4 additions & 4 deletions test/mocha/js/widgets/lot_derivates.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ define([
//$('#test').append($w);

minsub.publish(minsub.DISPLAY_DOCUMENTS, new ApiQuery({'q': 'bibcode:bar'}));
expect($w.find("label").length).to.equal(25);
expect($w.find("label").length).to.equal(26);

expect($w.find("a:first").attr("href")).to.eql('#search/q=citations(bibcode%3Abar)&sort=date%20desc');

Expand All @@ -129,7 +129,7 @@ define([
expect(query.url()).to.eql('fl=title%2Cbibcode%2Cauthor%2Ckeyword%2Cpub%2Caff%2Cvolume%2Cyear%2C%5Bcitations%5D%2Cproperty%2Cpubdate%2Cabstract%2Cesources%2Cdata&q=references(bibcode%3Abar)&rows=25&sort=first_author%20asc&start=0');

minsub.publish(minsub.DISPLAY_DOCUMENTS, new ApiQuery({'q': 'bibcode:bar'}));
expect($w.find("label").length).to.equal(25);
expect($w.find("label").length).to.equal(26);

expect($w.find(".s-list-description").text()).to.eql("Papers referenced by");

Expand All @@ -156,7 +156,7 @@ define([
expect(query.url()).to.eql( 'fl=title%2Cbibcode%2Cauthor%2Ckeyword%2Cpub%2Caff%2Cvolume%2Cyear%2C%5Bcitations%5D%2Cproperty%2Cpubdate%2Cabstract%2Cesources%2Cdata&q=trending(bibcode%3Abar)-bibcode%3Abar&rows=25&sort=date%20desc&start=0');

minsub.publish(minsub.DISPLAY_DOCUMENTS, new ApiQuery({'q': 'bibcode:bar'}));
expect($w.find("label").length).to.equal(25);
expect($w.find("label").length).to.equal(26);

expect($w.find(".s-list-description").text()).to.eql("Papers also read by those who read");

Expand All @@ -182,7 +182,7 @@ define([
var $w = widget.render().$el;

minsub.publish(minsub.DISPLAY_DOCUMENTS, new ApiQuery({'q': 'bibcode:bar'}));
expect($w.find("label").length).to.equal(25);
expect($w.find("label").length).to.equal(26);

expect($w.find(".s-list-description").text()).to.eql("Papers in the same volume as");

Expand Down

0 comments on commit 3b2bfb3

Please sign in to comment.