Skip to content
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

Sidepanel visibility on canvas focus #1173

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 0 additions & 7 deletions js/src/widgets/sidePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,11 @@

render: function(renderingData) {
var _this = this;

if (!this.element) {
this.element = this.appendTo;
jQuery(_this.template(renderingData)).appendTo(_this.appendTo);
return;
}

if (renderingData.open) {
this.appendTo.removeClass('minimized');
} else {
this.appendTo.addClass('minimized');
}
},

template: Handlebars.compile([
Expand Down
42 changes: 37 additions & 5 deletions spec/widgets/sidePanel.test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,46 @@
describe('SidePanel', function() {

function createSidePanel(sidePanelOptions) {
sidePanelOptions = sidePanelOptions || {};

var eventEmitter = new Mirador.EventEmitter();
var state = new Mirador.SaveController(jQuery.extend(
true, {}, Mirador.DEFAULT_SETTINGS, {eventEmitter: eventEmitter}
));
var fixture = getJSONFixture('BNF-condorcet-florus-dispersus-manifest.json');
var manifest = new Mirador.Manifest(fixture['@id'], 'IIIF', fixture);
var canvasID = manifest.getCanvases()[0]['@id'];
var appendTo = jQuery('<div class="sidePanel"></div>');

var config = jQuery.extend(true, {
windowId: '380c9e54-7561-4010-a99f-f132f5dc13fd',
state: state,
eventEmitter: eventEmitter,
appendTo: appendTo,
manifest: manifest,
canvasID: canvasID,
layersTabAvailable: false,
tocTabAvailable: false,
annotationsTabAvailable: false,
hasStructures: false
}, sidePanelOptions);

return new Mirador.SidePanel(config);
}

beforeEach(function() {

jasmine.getJSONFixtures().fixturesPath = 'spec/fixtures';
this.sidePanel = createSidePanel();
});

afterEach(function() {

});

xdescribe('Initialization', function() {
describe('Initialization', function() {
it('should initialize', function() {

expect(this.sidePanel instanceof Mirador.SidePanel).toBeTruthy();
expect(this.sidePanel.appendTo).toBeTruthy();
});
});

Expand All @@ -34,8 +64,10 @@ describe('SidePanel', function() {

});

xdescribe('render', function() {

describe('render', function() {
it('should render on initialization', function() {
expect(this.sidePanel.appendTo.html()).toBeTruthy();
});
});

xdescribe('toggle', function() {
Expand Down