Experimentation for using this with the always entry
Change-Id: Id749a581f0b97d204b0347f7730ea10522d7c735
diff --git a/dev/js/spec/alwaysMenuSpec.js b/dev/js/spec/alwaysMenuSpec.js
index f849ebd..de7a5a0 100644
--- a/dev/js/spec/alwaysMenuSpec.js
+++ b/dev/js/spec/alwaysMenuSpec.js
@@ -200,8 +200,9 @@
menu._firstActive = true;
expect(menu.itemClass()).toEqual(OwnAlwaysMenuItem);
expect(menu._notItemElements).toEqual(4);
- expect(menu.element().getElementsByClassName("pref").length).toEqual(2); //TODO: new scss = new class
- expect(menu.element().getElementsByClassName("pref")[1].innerHTML).toEqual("Speichern");
+ expect(menu.element().getElementsByClassName("entry").length).toEqual(1);
+ expect(menu.element().getElementsByClassName("entry").length).toEqual(1);
+ expect(menu.element().getElementsByClassName("entry")[0].innerHTML).toEqual("Speichern");
expect(menu.alwaysEntry().element().innerHTML).toEqual("Speichern");
//expect(menu.element().childNodes[3].innerHTML).toEqual("Speichern"); //?
// getElementsByClassName funktioniert bei allen Kindern.
@@ -1242,7 +1243,8 @@
describe('KorAP.AlwaysMenu.Entry', function () {
it('should be initializable', function () {
var p = alwaysEntryClass.create();
- expect(p.element().classList.contains('pref')).toBeTruthy();
+ expect(p.element().classList.contains('pref')).toBeFalsy();
+ expect(p.element().classList.contains('entry')).toBeTruthy();
expect(p.isSet()).not.toBeTruthy();
expect(p.element().innerHTML).toEqual("Speichern");
expect(p.value()).toEqual("");
@@ -1255,7 +1257,8 @@
it('should be initializable with a different name', function () {
var p = alwaysEntryClass.create("Save");
- expect(p.element().classList.contains('pref')).toBeTruthy();
+ expect(p.element().classList.contains('pref')).toBeFalsy();
+ expect(p.element().classList.contains('entry')).toBeTruthy();
expect(p.isSet()).not.toBeTruthy();
expect(p.element().innerHTML).toEqual("Save");
expect(p.value()).toEqual("");
diff --git a/dev/js/src/alwaysentry.js b/dev/js/src/alwaysentry.js
index f3f7b42..ae99ae9 100644
--- a/dev/js/src/alwaysentry.js
+++ b/dev/js/src/alwaysentry.js
@@ -26,16 +26,20 @@
.upgradeTo(this)
._init();
obj._el.innerHTML = text || "Speichern";
+ obj._el.classList.remove("pref");
+ obj._el.classList.add("entry");
//dont forget to adjust alwaysMenuSpec - alwaysEntry!
return obj;
},
_update : function () {
+ /*
if (this._string.length!==0){ // I assume that this is a sufficient criterium for infering that the prefix is active
this._el.style.bottom="-27px";
} else if (this._string.length===0) {
this._el.style.bottom="0px";
}
+ */
return this._string; // No need to change the text (=innerHTML)
},
diff --git a/dev/scss/base/menu.scss b/dev/scss/base/menu.scss
index 2fdd0a1..f8e8e35 100644
--- a/dev/scss/base/menu.scss
+++ b/dev/scss/base/menu.scss
@@ -187,6 +187,22 @@
margin-bottom: -2.1em;
padding: 2px 6px;
}
+ /**
+ * Default entry view
+ */
+ span.entry:not(:empty) {
+ position: absolute;
+ min-width: 5px;
+ font-size: 80%;
+ left: 0;
+ bottom: 0;
+ display: block;
+ margin-bottom: -2.1em;
+ padding: 2px 6px;
+ }
+ span.pref:not(:empty) ~ span.entry:not(:empty){
+ bottom: -27px;
+ }
}