Move slider on navigation using keys
diff --git a/dev/js/spec/menuSpec.js b/dev/js/spec/menuSpec.js
index 65fcc82..5f8ab9d 100644
--- a/dev/js/spec/menuSpec.js
+++ b/dev/js/spec/menuSpec.js
@@ -404,16 +404,16 @@
expect(menu.show()).toBe(true);
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Lemma</strong>");
- expect(menu.element().childNodes[3].getAttribute("data-action")).toEqual("l=");
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
- expect(menu.element().childNodes[5]).toBe(undefined);
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Lemma</strong>");
+ expect(menu.element().childNodes[4].getAttribute("data-action")).toEqual("l=");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[6]).toBe(undefined);
// Check boundaries
- expect(menu.element().childNodes[2].classList.contains("no-more")).toBe(true);
- expect(menu.element().childNodes[3].classList.contains("no-more")).toBe(false);
+ expect(menu.element().childNodes[3].classList.contains("no-more")).toBe(true);
expect(menu.element().childNodes[4].classList.contains("no-more")).toBe(false);
+ expect(menu.element().childNodes[5].classList.contains("no-more")).toBe(false);
});
it('should be filterable', function () {
@@ -421,44 +421,44 @@
menu.limit(3);
expect(menu.prefix("o").show()).toBe(true);
expect(menu.element().childNodes[0].innerHTML).toEqual("o");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>C<mark>o</mark>nstituency</strong><span>Example 1</span>");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Part-<mark>o</mark>f-Speech</strong>");
- expect(menu.element().childNodes[5]).toBe(undefined);
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>C<mark>o</mark>nstituency</strong><span>Example 1</span>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Part-<mark>o</mark>f-Speech</strong>");
+ expect(menu.element().childNodes[6]).toBe(undefined);
// Check boundaries
- expect(menu.element().childNodes[2].classList.contains("no-more")).toBe(true);
- expect(menu.element().childNodes[3].classList.contains("no-more")).toBe(false);
- expect(menu.element().childNodes[4].classList.contains("no-more")).toBe(true);
+ expect(menu.element().childNodes[3].classList.contains("no-more")).toBe(true);
+ expect(menu.element().childNodes[4].classList.contains("no-more")).toBe(false);
+ expect(menu.element().childNodes[5].classList.contains("no-more")).toBe(true);
menu.limit(2);
expect(menu.prefix("o").show()).toBe(true);
expect(menu.element().childNodes[0].innerHTML).toEqual("o");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>C<mark>o</mark>nstituency</strong><span>Example 1</span>");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
- expect(menu.element().childNodes[4]).toBe(undefined);
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>C<mark>o</mark>nstituency</strong><span>Example 1</span>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[5]).toBe(undefined);
// Check boundaries
- expect(menu.element().childNodes[2].classList.contains("no-more")).toBe(true);
- expect(menu.element().childNodes[3].classList.contains("no-more")).toBe(false);
- expect(menu.element().childNodes[4]).toBe(undefined);
+ expect(menu.element().childNodes[3].classList.contains("no-more")).toBe(true);
+ expect(menu.element().childNodes[4].classList.contains("no-more")).toBe(false);
+ expect(menu.element().childNodes[5]).toBe(undefined);
expect(menu.prefix("e").show()).toBe(true);
expect(menu.element().childNodes[0].innerHTML).toEqual("e");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Constitu<mark>e</mark>ncy</strong><span><mark>E</mark>xampl<mark>e</mark> 1</span>");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Morphology</strong><span><mark>E</mark>xampl<mark>e</mark> 2</span>");
- expect(menu.element().childNodes[4]).toBe(undefined);
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Constitu<mark>e</mark>ncy</strong><span><mark>E</mark>xampl<mark>e</mark> 1</span>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Morphology</strong><span><mark>E</mark>xampl<mark>e</mark> 2</span>");
+ expect(menu.element().childNodes[5]).toBe(undefined);
menu.limit(5);
expect(menu.prefix("a").show()).toBe(true);
expect(menu.element().childNodes[0].innerHTML).toEqual("a");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Constituency</strong><span>Ex<mark>a</mark>mple 1</span>");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Lemm<mark>a</mark></strong>");
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Morphology</strong><span>Ex<mark>a</mark>mple 2</span>");
- expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>P<mark>a</mark>rt-of-Speech</strong>");
- expect(menu.element().childNodes[6].innerHTML).toEqual("<strong>Synt<mark>a</mark>x</strong>");
- expect(menu.element().childNodes[7]).toBe(undefined);
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Constituency</strong><span>Ex<mark>a</mark>mple 1</span>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Lemm<mark>a</mark></strong>");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Morphology</strong><span>Ex<mark>a</mark>mple 2</span>");
+ expect(menu.element().childNodes[6].innerHTML).toEqual("<strong>P<mark>a</mark>rt-of-Speech</strong>");
+ expect(menu.element().childNodes[7].innerHTML).toEqual("<strong>Synt<mark>a</mark>x</strong>");
+ expect(menu.element().childNodes[8]).toBe(undefined);
});
@@ -469,74 +469,74 @@
// Show only 3 items
menu.limit(3);
expect(menu.show()).toBe(true);
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Lemma</strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Lemma</strong>");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element().childNodes[5]).toBe(undefined);
+ expect(menu.element().childNodes[6]).toBe(undefined);
// Activate next (1)
menu.next();
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Lemma</strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Lemma</strong>");
expect(menu.shownItem(1).active()).toBe(true);
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element().childNodes[5]).toBe(undefined);
+ expect(menu.element().childNodes[6]).toBe(undefined);
// Activate next (2)
menu.next();
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Lemma</strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Lemma</strong>");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(2).active()).toBe(true);
- expect(menu.element().childNodes[5]).toBe(undefined);
+ expect(menu.element().childNodes[6]).toBe(undefined);
// Activate next (3)
// scroll!
menu.next();
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Lemma</strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Lemma</strong>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
expect(menu.shownItem(2).active()).toBe(true);
- expect(menu.element().childNodes[5]).toBe(undefined);
+ expect(menu.element().childNodes[6]).toBe(undefined);
// Activate next (4)
menu.next();
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Syntax</strong>");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Syntax</strong>");
expect(menu.shownItem(2).active()).toBe(true);
- expect(menu.element().childNodes[5]).toBe(undefined);
+ expect(menu.element().childNodes[6]).toBe(undefined);
// Activate next (5) - ROLL
menu.next();
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Lemma</strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Lemma</strong>");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element().childNodes[5]).toBe(undefined);
+ expect(menu.element().childNodes[6]).toBe(undefined);
// Active next (6)
menu.next();
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Lemma</strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Lemma</strong>");
expect(menu.shownItem(1).active()).toBe(true);
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element().childNodes[5]).toBe(undefined);
+ expect(menu.element().childNodes[6]).toBe(undefined);
});
it('should be prevable', function () {
@@ -545,33 +545,33 @@
menu.limit(3);
expect(menu.show()).toBe(true);
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Lemma</strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Lemma</strong>");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element().childNodes[5]).toBe(undefined);
+ expect(menu.element().childNodes[6]).toBe(undefined);
// Activate prev (1) - roll to bottom
menu.prev();
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
expect(menu.shownItem(1).active()).toBe(false);
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Syntax</strong>");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Syntax</strong>");
expect(menu.shownItem(2).active()).toBe(true);
- expect(menu.element().childNodes[5]).toBe(undefined);
+ expect(menu.element().childNodes[6]).toBe(undefined);
// Activate prev (2)
menu.prev();
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
expect(menu.shownItem(0).active()).toBe(false);
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
expect(menu.shownItem(1).active()).toBe(true);
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Syntax</strong>");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Syntax</strong>");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element().childNodes[5]).toBe(undefined);
+ expect(menu.element().childNodes[6]).toBe(undefined);
// Activate prev (3)
menu.prev();
@@ -581,7 +581,7 @@
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2).name()).toEqual("Syntax");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element().childNodes[5]).toBe(undefined);
+ expect(menu.element().childNodes[6]).toBe(undefined);
// Activate prev (4)
menu.prev();
@@ -591,7 +591,7 @@
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2).name()).toEqual("Part-of-Speech");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element().childNodes[5]).toBe(undefined);
+ expect(menu.element().childNodes[6]).toBe(undefined);
// Activate prev (5)
menu.prev();
@@ -601,7 +601,7 @@
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2).name()).toEqual("Morphology");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element().childNodes[5]).toBe(undefined);
+ expect(menu.element().childNodes[6]).toBe(undefined);
// Activate next (1)
menu.next();
@@ -611,7 +611,7 @@
expect(menu.shownItem(1).active()).toBe(true);
expect(menu.shownItem(2).name()).toEqual("Morphology");
expect(menu.shownItem(2).active()).toBe(false);
- expect(menu.element().childNodes[5]).toBe(undefined);
+ expect(menu.element().childNodes[6]).toBe(undefined);
// Activate prev (6)
menu.prev();
@@ -624,7 +624,7 @@
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2).name()).toEqual("Syntax");
expect(menu.shownItem(2).active()).toBe(true);
- expect(menu.element().childNodes[5]).toBe(undefined);
+ expect(menu.element().childNodes[6]).toBe(undefined);
});
@@ -635,49 +635,49 @@
expect(menu.prefix("o").show()).toBe(true);
expect(menu.shownItem(0).name()).toEqual("Constituency");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>C<mark>o</mark>nstituency</strong><span>Example 1</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>C<mark>o</mark>nstituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
expect(menu.shownItem(1).name()).toEqual("Morphology");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
// Next (1)
menu.next();
expect(menu.shownItem(0).name()).toEqual("Constituency");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>C<mark>o</mark>nstituency</strong><span>Example 1</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>C<mark>o</mark>nstituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(false);
expect(menu.shownItem(1).name()).toEqual("Morphology");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
expect(menu.shownItem(1).active()).toBe(true);
expect(menu.shownItem(2)).toBe(undefined);
// Next (2)
menu.next();
expect(menu.shownItem(0).name()).toEqual("Morphology");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
expect(menu.shownItem(0).active()).toBe(false);
expect(menu.shownItem(1).name()).toEqual("Part-of-Speech");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Part-<mark>o</mark>f-Speech</strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Part-<mark>o</mark>f-Speech</strong>");
expect(menu.shownItem(1).active()).toBe(true);
expect(menu.shownItem(2)).toBe(undefined);
// Next (3) - to prefix
menu.next();
expect(menu.shownItem(0).name()).toEqual("Morphology");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
expect(menu.shownItem(0).active()).toBe(false);
expect(menu.shownItem(1).name()).toEqual("Part-of-Speech");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Part-<mark>o</mark>f-Speech</strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Part-<mark>o</mark>f-Speech</strong>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
menu.next();
expect(menu.shownItem(0).name()).toEqual("Constituency");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>C<mark>o</mark>nstituency</strong><span>Example 1</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>C<mark>o</mark>nstituency</strong><span>Example 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
expect(menu.shownItem(1).name()).toEqual("Morphology");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
});
@@ -691,20 +691,20 @@
expect(menu.prefix("ex").show()).toBe(true);
expect(menu.shownItem(0).name()).toEqual("Constituency");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Constituency</strong><span><mark>Ex</mark>ample 1</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Constituency</strong><span><mark>Ex</mark>ample 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
expect(menu.shownItem(1).name()).toEqual("Morphology");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Morphology</strong><span><mark>Ex</mark>ample 2</span>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Morphology</strong><span><mark>Ex</mark>ample 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
// Next (1)
menu.next();
expect(menu.shownItem(0).name()).toEqual("Constituency");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Constituency</strong><span><mark>Ex</mark>ample 1</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Constituency</strong><span><mark>Ex</mark>ample 1</span>");
expect(menu.shownItem(0).active()).toBe(false);
expect(menu.shownItem(1).name()).toEqual("Morphology");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Morphology</strong><span><mark>Ex</mark>ample 2</span>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Morphology</strong><span><mark>Ex</mark>ample 2</span>");
expect(menu.shownItem(1).active()).toBe(true);
expect(menu.shownItem(2)).toBe(undefined);
@@ -713,11 +713,11 @@
expect(menu.prefix()).toEqual('ex');
expect(menu.shownItem(0).name()).toEqual("Constituency");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Constituency</strong><span><mark>Ex</mark>ample 1</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Constituency</strong><span><mark>Ex</mark>ample 1</span>");
expect(menu.shownItem(0).active()).toBe(false);
expect(menu.shownItem(1).name()).toEqual("Morphology");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Morphology</strong><span><mark>Ex</mark>ample 2</span>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Morphology</strong><span><mark>Ex</mark>ample 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
@@ -728,10 +728,10 @@
expect(menu.prefix("e").show()).toBe(true);
expect(menu._prefix.active()).toBe(false);
expect(menu.shownItem(0).name()).toEqual("Constituency");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Constitu<mark>e</mark>ncy</strong><span><mark>E</mark>xampl<mark>e</mark> 1</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Constitu<mark>e</mark>ncy</strong><span><mark>E</mark>xampl<mark>e</mark> 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
expect(menu.shownItem(1).name()).toEqual("Morphology");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Morphology</strong><span><mark>E</mark>xampl<mark>e</mark> 2</span>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Morphology</strong><span><mark>E</mark>xampl<mark>e</mark> 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
@@ -740,10 +740,10 @@
expect(menu._prefix.active()).toBe(false);
expect(menu.prefix()).toEqual('e');
expect(menu.shownItem(0).name()).toEqual("Constituency");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Constitu<mark>e</mark>ncy</strong><span><mark>E</mark>xampl<mark>e</mark> 1</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Constitu<mark>e</mark>ncy</strong><span><mark>E</mark>xampl<mark>e</mark> 1</span>");
expect(menu.shownItem(0).active()).toBe(false);
expect(menu.shownItem(1).name()).toEqual("Morphology");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Morphology</strong><span><mark>E</mark>xampl<mark>e</mark> 2</span>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Morphology</strong><span><mark>E</mark>xampl<mark>e</mark> 2</span>");
expect(menu.shownItem(1).active()).toBe(true);
expect(menu.shownItem(2)).toBe(undefined);
@@ -751,10 +751,10 @@
menu.next();
expect(menu._prefix.active()).toBe(true);
expect(menu.shownItem(0).name()).toEqual("Constituency");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Constitu<mark>e</mark>ncy</strong><span><mark>E</mark>xampl<mark>e</mark> 1</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Constitu<mark>e</mark>ncy</strong><span><mark>E</mark>xampl<mark>e</mark> 1</span>");
expect(menu.shownItem(0).active()).toBe(false);
expect(menu.shownItem(1).name()).toEqual("Morphology");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Morphology</strong><span><mark>E</mark>xampl<mark>e</mark> 2</span>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Morphology</strong><span><mark>E</mark>xampl<mark>e</mark> 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
@@ -762,10 +762,10 @@
menu.next();
expect(menu._prefix.active()).toBe(false);
expect(menu.shownItem(0).name()).toEqual("Constituency");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Constitu<mark>e</mark>ncy</strong><span><mark>E</mark>xampl<mark>e</mark> 1</span>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Constitu<mark>e</mark>ncy</strong><span><mark>E</mark>xampl<mark>e</mark> 1</span>");
expect(menu.shownItem(0).active()).toBe(true);
expect(menu.shownItem(1).name()).toEqual("Morphology");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Morphology</strong><span><mark>E</mark>xampl<mark>e</mark> 2</span>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Morphology</strong><span><mark>E</mark>xampl<mark>e</mark> 2</span>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
});
@@ -788,13 +788,13 @@
expect(menu.prefix()).toEqual("");
expect(menu.shownItem(0).name()).toEqual("Titel");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Titel</strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Titel</strong>");
expect(menu.shownItem(0).active()).toBe(true);
expect(menu.shownItem(1).name()).toEqual("Untertitel");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Untertitel</strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Untertitel</strong>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2).name()).toEqual("Veröffentlichungsdatum");
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Veröffentlichungsdatum</strong>");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Veröffentlichungsdatum</strong>");
expect(menu.shownItem(2).active()).toBe(false);
expect(menu.shownItem(3)).toBe(undefined);
@@ -802,31 +802,31 @@
expect(menu.show()).toBe(true);
expect(menu.prefix()).toEqual("a");
expect(menu.shownItem(0).name()).toEqual("Autor");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong><mark>A</mark>utor</strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong><mark>A</mark>utor</strong>");
menu._prefix.add('u');
expect(menu.show()).toBe(true);
expect(menu.prefix()).toEqual("au");
expect(menu.shownItem(0).name()).toEqual("Autor");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong><mark>Au</mark>tor</strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong><mark>Au</mark>tor</strong>");
menu._prefix.chop();
expect(menu.show()).toBe(true);
expect(menu.prefix()).toEqual("a");
expect(menu.shownItem(0).name()).toEqual("Autor");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong><mark>A</mark>utor</strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong><mark>A</mark>utor</strong>");
menu._prefix.chop();
expect(menu.show()).toBe(true);
expect(menu.prefix()).toEqual("");
expect(menu.shownItem(0).name()).toEqual("Titel");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Titel</strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Titel</strong>");
expect(menu.shownItem(0).active()).toBe(true);
expect(menu.shownItem(1).name()).toEqual("Untertitel");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Untertitel</strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Untertitel</strong>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2).name()).toEqual("Veröffentlichungsdatum");
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Veröffentlichungsdatum</strong>");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Veröffentlichungsdatum</strong>");
expect(menu.shownItem(2).active()).toBe(false);
expect(menu.shownItem(3)).toBe(undefined);
@@ -835,26 +835,26 @@
expect(menu.show()).toBe(true);
expect(menu.prefix()).toEqual("");
expect(menu.shownItem(0).name()).toEqual("Titel");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Titel</strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Titel</strong>");
expect(menu.shownItem(0).active()).toBe(true);
expect(menu.shownItem(1).name()).toEqual("Untertitel");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Untertitel</strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Untertitel</strong>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2).name()).toEqual("Veröffentlichungsdatum");
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Veröffentlichungsdatum</strong>");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Veröffentlichungsdatum</strong>");
expect(menu.shownItem(2).active()).toBe(false);
// Forward
menu.next();
expect(menu.prefix()).toEqual("");
expect(menu.shownItem(0).name()).toEqual("Titel");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Titel</strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Titel</strong>");
expect(menu.shownItem(0).active()).toBe(false);
expect(menu.shownItem(1).name()).toEqual("Untertitel");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Untertitel</strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Untertitel</strong>");
expect(menu.shownItem(1).active()).toBe(true);
expect(menu.shownItem(2).name()).toEqual("Veröffentlichungsdatum");
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Veröffentlichungsdatum</strong>");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Veröffentlichungsdatum</strong>");
expect(menu.shownItem(2).active()).toBe(false);
expect(menu.shownItem(3)).toBe(undefined);
@@ -862,13 +862,13 @@
menu.next();
expect(menu.prefix()).toEqual("");
expect(menu.shownItem(0).name()).toEqual("Titel");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Titel</strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Titel</strong>");
expect(menu.shownItem(0).active()).toBe(false);
expect(menu.shownItem(1).name()).toEqual("Untertitel");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Untertitel</strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Untertitel</strong>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2).name()).toEqual("Veröffentlichungsdatum");
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Veröffentlichungsdatum</strong>");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Veröffentlichungsdatum</strong>");
expect(menu.shownItem(2).active()).toBe(true);
expect(menu.shownItem(3)).toBe(undefined);
@@ -876,13 +876,13 @@
menu.next();
expect(menu.prefix()).toEqual("");
expect(menu.shownItem(0).name()).toEqual("Untertitel");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Untertitel</strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Untertitel</strong>");
expect(menu.shownItem(0).active()).toBe(false);
expect(menu.shownItem(1).name()).toEqual("Veröffentlichungsdatum");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Veröffentlichungsdatum</strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Veröffentlichungsdatum</strong>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2).name()).toEqual("Länge");
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Länge</strong>");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Länge</strong>");
expect(menu.shownItem(2).active()).toBe(true);
expect(menu.shownItem(3)).toBe(undefined);
@@ -890,13 +890,13 @@
menu.next();
expect(menu.prefix()).toEqual("");
expect(menu.shownItem(0).name()).toEqual("Veröffentlichungsdatum");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Veröffentlichungsdatum</strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Veröffentlichungsdatum</strong>");
expect(menu.shownItem(0).active()).toBe(false);
expect(menu.shownItem(1).name()).toEqual("Länge");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Länge</strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Länge</strong>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2).name()).toEqual("Autor");
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Autor</strong>");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Autor</strong>");
expect(menu.shownItem(2).active()).toBe(true);
expect(menu.shownItem(3)).toBe(undefined);
@@ -904,13 +904,13 @@
menu.next();
expect(menu.prefix()).toEqual("");
expect(menu.shownItem(0).name()).toEqual("Titel");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Titel</strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Titel</strong>");
expect(menu.shownItem(0).active()).toBe(true);
expect(menu.shownItem(1).name()).toEqual("Untertitel");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Untertitel</strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Untertitel</strong>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2).name()).toEqual("Veröffentlichungsdatum");
- expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Veröffentlichungsdatum</strong>");
+ expect(menu.element().childNodes[5].innerHTML).toEqual("<strong>Veröffentlichungsdatum</strong>");
expect(menu.shownItem(2).active()).toBe(false);
});
@@ -930,10 +930,10 @@
expect(menu.prefix()).toEqual("el");
expect(menu._prefix.active()).toEqual(false);
expect(menu.shownItem(0).name()).toEqual("Titel");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Tit<mark>el</mark></strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Tit<mark>el</mark></strong>");
expect(menu.shownItem(0).active()).toBe(true);
expect(menu.shownItem(1).name()).toEqual("Untertitel");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Untertit<mark>el</mark></strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Untertit<mark>el</mark></strong>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
@@ -942,10 +942,10 @@
expect(menu.prefix()).toEqual("el");
expect(menu._prefix.active()).toEqual(false);
expect(menu.shownItem(0).name()).toEqual("Titel");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Tit<mark>el</mark></strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Tit<mark>el</mark></strong>");
expect(menu.shownItem(0).active()).toBe(false);
expect(menu.shownItem(1).name()).toEqual("Untertitel");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Untertit<mark>el</mark></strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Untertit<mark>el</mark></strong>");
expect(menu.shownItem(1).active()).toBe(true);
expect(menu.shownItem(2)).toBe(undefined);
@@ -954,10 +954,10 @@
expect(menu.prefix()).toEqual("el");
expect(menu._prefix.active()).toEqual(true);
expect(menu.shownItem(0).name()).toEqual("Titel");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Tit<mark>el</mark></strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Tit<mark>el</mark></strong>");
expect(menu.shownItem(0).active()).toBe(false);
expect(menu.shownItem(1).name()).toEqual("Untertitel");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Untertit<mark>el</mark></strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Untertit<mark>el</mark></strong>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
@@ -966,11 +966,11 @@
expect(menu.prefix()).toEqual("el");
expect(menu._prefix.active()).toEqual(false);
expect(menu.shownItem(0).name()).toEqual("Titel");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Tit<mark>el</mark></strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Tit<mark>el</mark></strong>");
expect(menu.shownItem(0).active()).toBe(false);
expect(menu.shownItem(1).name()).toEqual("Untertitel");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Untertit<mark>el</mark></strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Untertit<mark>el</mark></strong>");
expect(menu.shownItem(1).active()).toBe(true);
expect(menu.shownItem(2)).toBe(undefined);
});
@@ -989,10 +989,10 @@
expect(menu.prefix()).toEqual("el");
expect(menu._prefix.active()).toEqual(false);
expect(menu.shownItem(0).name()).toEqual("Titel");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Tit<mark>el</mark></strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Tit<mark>el</mark></strong>");
expect(menu.shownItem(0).active()).toBe(true);
expect(menu.shownItem(1).name()).toEqual("Untertitel");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Untertit<mark>el</mark></strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Untertit<mark>el</mark></strong>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
@@ -1001,11 +1001,11 @@
expect(menu._prefix.active()).toEqual(true);
expect(menu.shownItem(0).name()).toEqual("Titel");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Tit<mark>el</mark></strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Tit<mark>el</mark></strong>");
expect(menu.shownItem(0).active()).toBe(false);
expect(menu.shownItem(1).name()).toEqual("Untertitel");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Untertit<mark>el</mark></strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Untertit<mark>el</mark></strong>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
@@ -1013,10 +1013,10 @@
menu.prev();
expect(menu._prefix.active()).toEqual(false);
expect(menu.shownItem(0).name()).toEqual("Titel");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Tit<mark>el</mark></strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Tit<mark>el</mark></strong>");
expect(menu.shownItem(0).active()).toBe(false);
expect(menu.shownItem(1).name()).toEqual("Untertitel");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Untertit<mark>el</mark></strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Untertit<mark>el</mark></strong>");
expect(menu.shownItem(1).active()).toBe(true);
expect(menu.shownItem(2)).toBe(undefined);
});
@@ -1033,10 +1033,10 @@
expect(menu.prefix()).toEqual("el");
expect(menu._prefix.active()).toEqual(false);
expect(menu.shownItem(0).name()).toEqual("Titel");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Tit<mark>el</mark></strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Tit<mark>el</mark></strong>");
expect(menu.shownItem(0).active()).toBe(true);
expect(menu.shownItem(1).name()).toEqual("Untertitel");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Untertit<mark>el</mark></strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Untertit<mark>el</mark></strong>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
@@ -1044,10 +1044,10 @@
menu.prev();
expect(menu._prefix.active()).toEqual(true);
expect(menu.shownItem(0).name()).toEqual("Titel");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Tit<mark>el</mark></strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Tit<mark>el</mark></strong>");
expect(menu.shownItem(0).active()).toBe(false);
expect(menu.shownItem(1).name()).toEqual("Untertitel");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Untertit<mark>el</mark></strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Untertit<mark>el</mark></strong>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
@@ -1057,10 +1057,10 @@
expect(menu.prefix()).toEqual("el");
expect(menu._prefix.active()).toEqual(false);
expect(menu.shownItem(0).name()).toEqual("Titel");
- expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Tit<mark>el</mark></strong>");
+ expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Tit<mark>el</mark></strong>");
expect(menu.shownItem(0).active()).toBe(true);
expect(menu.shownItem(1).name()).toEqual("Untertitel");
- expect(menu.element().childNodes[3].innerHTML).toEqual("<strong>Untertit<mark>el</mark></strong>");
+ expect(menu.element().childNodes[4].innerHTML).toEqual("<strong>Untertit<mark>el</mark></strong>");
expect(menu.shownItem(1).active()).toBe(false);
expect(menu.shownItem(2)).toBe(undefined);
@@ -1182,4 +1182,67 @@
expect(menu.lengthField().element().children.length).toEqual(5);
});
});
+
+ describe('KorAP.Slider', function () {
+ it('should be correctly initializable', function () {
+ var list = [
+ ["Constituency"],
+ ["Lemma"],
+ ["Morphology"],
+ ["Part-of-Speech"],
+ ["Syntax"]
+ ];
+
+ var menu = KorAP.OwnMenu.create(list);
+
+ menu._firstActive = true;
+ menu.limit(3);
+
+ expect(menu.show()).toBe(true);
+
+ expect(menu.shownItem(0).active()).toBe(true);
+ expect(menu.shownItem(1).active()).toBe(false);
+ expect(menu.shownItem(2).active()).toBe(false);
+ expect(menu.slider().offset()).toEqual(0);
+ expect(menu.position).toEqual(0);
+
+ menu.next();
+ expect(menu.shownItem(0).active()).toBe(false);
+ expect(menu.shownItem(1).active()).toBe(true);
+ expect(menu.shownItem(2).active()).toBe(false);
+ expect(menu.slider().offset()).toEqual(0);
+ expect(menu.position).toEqual(1);
+
+ menu.next();
+ expect(menu.shownItem(0).active()).toBe(false);
+ expect(menu.shownItem(1).active()).toBe(false);
+ expect(menu.shownItem(2).active()).toBe(true);
+ expect(menu.slider().offset()).toEqual(0);
+ expect(menu.position).toEqual(2);
+
+ menu.next();
+ expect(menu.shownItem(0).active()).toBe(false);
+ expect(menu.shownItem(1).active()).toBe(false);
+ expect(menu.shownItem(2).active()).toBe(true);
+ expect(menu.slider().offset()).toEqual(1);
+ expect(menu.position).toEqual(3);
+
+ menu.next();
+ expect(menu.shownItem(0).active()).toBe(false);
+ expect(menu.shownItem(1).active()).toBe(false);
+ expect(menu.shownItem(2).active()).toBe(true);
+ expect(menu.slider().offset()).toEqual(2);
+ expect(menu.position).toEqual(4);
+
+ menu.next();
+ expect(menu.shownItem(0).active()).toBe(true);
+ expect(menu.shownItem(1).active()).toBe(false);
+ expect(menu.shownItem(2).active()).toBe(false);
+ expect(menu.slider().offset()).toEqual(0);
+ expect(menu.position).toEqual(0);
+
+ expect(menu.slider()._slider.style.height).toEqual('60%');
+
+ });
+ });
});
diff --git a/dev/js/src/menu.js b/dev/js/src/menu.js
index 183e97a..bd363e3 100644
--- a/dev/js/src/menu.js
+++ b/dev/js/src/menu.js
@@ -115,7 +115,7 @@
if (this._prefix.active())
break;
- var item = this.liveItem(this._position);
+ var item = this.liveItem(this.position);
if (item["further"] !== undefined) {
item["further"].bind(item).apply();
@@ -131,7 +131,7 @@
// Click on item
else
- this.liveItem(this._position).onclick(e);
+ this.liveItem(this.position).onclick(e);
e.halt();
break;
case 8: // 'Backspace'
@@ -238,11 +238,11 @@
};
this._limit = menuLimit;
- this._slider.length(i);
+ this._slider.length(this.liveLength());
this._slider.limit(this._limit);
- this._position = 0; // position in the active list
- this._active = -1; // active item in the item list
+ this.position = 0; // position in the active list
+ this._active = -1; // active item in the item list
this._firstActive = false; // Show the first item active always?
this._reset();
return this;
@@ -255,6 +255,9 @@
return this._element;
},
+ slider : function () {
+ return this._slider;
+ },
/**
* Get the creator class for items
@@ -318,7 +321,7 @@
if (this._firstActive)
this.liveItem(0).active(true);
- this._position = 0;
+ this.position = 0;
this._prefix.active(false);
@@ -328,7 +331,7 @@
// Iterate to the active item
if (this._active !== -1 && !this._prefix.isSet()) {
- while (this._list[this._position] < this._active) {
+ while (this._list[this.position] < this._active) {
this.next();
};
};
@@ -500,6 +503,8 @@
// Append element
this.element().appendChild(item.element());
+
+ this._slider.offset(this._offset);
},
@@ -517,6 +522,8 @@
item.element(),
e.children[3]
);
+
+ this._slider.offset(this._offset);
},
@@ -572,20 +579,20 @@
next : function () {
// No active element set
- if (this._position === -1)
+ if (this.position === -1)
return;
var newItem;
// Set new live item
if (!this._prefix.active()) {
- var oldItem = this.liveItem(this._position);
+ var oldItem = this.liveItem(this.position);
oldItem.active(false);
};
- this._position++;
+ this.position++;
- newItem = this.liveItem(this._position);
+ newItem = this.liveItem(this.position);
// The next element is undefined - roll to top or to prefix
if (newItem === undefined) {
@@ -595,23 +602,23 @@
// Mark prefix
if (prefix.isSet() && !prefix.active()) {
- this._position--;
+ this.position--;
prefix.active(true);
return;
}
else {
this._offset = 0;
- this._position = 0;
+ this.position = 0;
newItem = this.liveItem(0);
this._showItems(0);
};
}
// The next element is outside the view - roll down
- else if (this._position >= (this.limit() + this._offset)) {
+ else if (this.position >= (this.limit() + this._offset)) {
this._removeFirst();
this._offset++;
- this._append(this._list[this._position]);
+ this._append(this._list[this.position]);
};
this._prefix.active(false);
@@ -630,11 +637,11 @@
}
// Last item is chosen
- else if (this._position >= this.limit() + this._offset) {
+ else if (this.position >= this.limit() + this._offset) {
- this._position = this.limit() + this._offset - 1;
- newItem = this.liveItem(this._position);
- var oldItem = this.liveItem(this._position--);
+ this.position = this.limit() + this._offset - 1;
+ newItem = this.liveItem(this.position);
+ var oldItem = this.liveItem(this.position--);
oldItem.active(false);
}
@@ -643,11 +650,11 @@
// Jump to last item
else {
- var oldItem = this.liveItem(this._position);
+ var oldItem = this.liveItem(this.position);
oldItem.active(false);
- this._position = this.limit() + this._offset - 1;
- newItem = this.liveItem(this._position);
+ this.position = this.limit() + this._offset - 1;
+ newItem = this.liveItem(this.position);
};
newItem.active(true);
@@ -661,7 +668,7 @@
prev : function () {
// No active element set
- if (this._position === -1) {
+ if (this.position === -1) {
return;
// TODO: Choose last item
};
@@ -670,11 +677,11 @@
// Set new live item
if (!this._prefix.active()) {
- var oldItem = this.liveItem(this._position--);
+ var oldItem = this.liveItem(this.position--);
oldItem.active(false);
};
- newItem = this.liveItem(this._position);
+ newItem = this.liveItem(this.position);
// The previous element is undefined - roll to bottom
if (newItem === undefined) {
@@ -686,24 +693,24 @@
// Normalize offset
this._offset = this._offset < 0 ? 0 : this._offset;
- this._position = this.liveLength() - 1;
+ this.position = this.liveLength() - 1;
if (prefix.isSet() && !prefix.active()) {
- this._position++;
+ this.position++;
prefix.active(true);
return;
}
else {
- newItem = this.liveItem(this._position);
+ newItem = this.liveItem(this.position);
this._showItems(this._offset);
};
}
// The previous element is outside the view - roll up
- else if (this._position < this._offset) {
+ else if (this.position < this._offset) {
this._removeLast();
this._offset--;
- this._prepend(this._list[this._position]);
+ this._prepend(this._list[this.position]);
};
this._prefix.active(false);
diff --git a/dev/js/src/menu/slider.js b/dev/js/src/menu/slider.js
index 8f27289..c1f0440 100644
--- a/dev/js/src/menu/slider.js
+++ b/dev/js/src/menu/slider.js
@@ -10,6 +10,8 @@
// Initialize prefix object
_init : function () {
+ this._offset = 0;
+
this._element = document.createElement('div');
this._element.setAttribute('class', 'ruler');
@@ -34,16 +36,31 @@
return this;
},
+ _initSize : function () {
+ this._height = ((this._limit / this._length) * 100);
+ this._step = (100 - this._height) / (this._length - this._limit);
+ },
+
show : function (i) {
- this._slider.style.height = ((this._limit / this._length) * 100) + '%';
+ this._slider.style.height = this._height + '%';
},
length : function (i) {
this._length = i;
+ this._initSize();
},
limit : function (i) {
this._limit = i;
+ this._initSize();
+ },
+
+ offset : function (off) {
+ if (off === undefined)
+ return this._offset;
+
+ this._offset = off;
+ this._slider.style.top = (this._step * off) + '%';
},
element : function () {