Commit 4de125b6 authored by Hannah Stepanek's avatar Hannah Stepanek

Add tests for selecting page tab when only notes

This adds two tests that verify the annotations tab is selected
when there are annotations present and the page notes tab is
selected when only page notes are present.
parent cca9dabd
......@@ -10,6 +10,7 @@ var uiConstants = require('../ui-constants');
var defaultAnnotation = annotationFixtures.defaultAnnotation;
var newAnnotation = annotationFixtures.newAnnotation;
var oldPageNote = annotationFixtures.oldPageNote;
var fixtures = immutable({
pair: [
......@@ -79,6 +80,27 @@ describe('annotationUI', function () {
[sinon.match(annot)]);
});
it('does not change selectedTab state if annotations are already loaded', function () {
var annot = defaultAnnotation();
annotationUI.addAnnotations([annot]);
var page = oldPageNote();
annotationUI.addAnnotations([page]);
assert.equal(annotationUI.getState().selectedTab, uiConstants.TAB_ANNOTATIONS);
});
it('sets the selectedTab to page if only page notes are present', function () {
var page = oldPageNote();
annotationUI.addAnnotations([page]);
assert.equal(annotationUI.getState().selectedTab, uiConstants.TAB_NOTES);
});
it('leaves the selectedTab as annotation if annotations and/or page notes are present', function () {
var page = oldPageNote();
var annot = defaultAnnotation();
annotationUI.addAnnotations([annot, page]);
assert.equal(annotationUI.getState().selectedTab, uiConstants.TAB_ANNOTATIONS);
});
it('assigns a local tag to annotations', function () {
var annotA = Object.assign(defaultAnnotation(), {id: 'a1'});
var annotB = Object.assign(defaultAnnotation(), {id: 'a2'});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment