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

Fix #1973 #1986

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions test/spec/ui/repetition-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ TestPageLoader.queueTest("repetition/repetition", function (testPage) {

// BUG: Chrome outputs 0 on this..
// expects(querySelector("#list3 > li:nth-child(2) > ul#list4-1").length).toBe(5);
var list3a = testPage.evaluateNode("//*[@class='list3']/li[2]/ul[@class='list3a']");
var list3a = testPage.evaluateNode("//*[@class='list3 montage-Repetition']/li[2]/ul[@class='list3a montage-Repetition']");
expect(list3a.querySelectorAll("li").length).toBe(5);
console.log("should draw one>five iterations –expectationFunction expect 2 passed");

Expand Down Expand Up @@ -517,7 +517,7 @@ TestPageLoader.queueTest("repetition/repetition", function (testPage) {

// BUG: Chrome outputs 0 on this..
// expect(querySelectorAll("#list3 > li:nth-child(2) > ul#list4-1 > li").length).toBe(5);
var list4a = testPage.evaluateNode("//*[@class='list4']/li[2]/ul[@class='list4a']");
var list4a = testPage.evaluateNode("//*[@class='list4 montage-Repetition']/li[2]/ul[@class='list4a montage-Repetition']");
expect(list4a.querySelectorAll("li").length).toBe(5);
var inputs = list4a.querySelectorAll("input");
expect(inputs.length).toBe(5);
Expand Down Expand Up @@ -586,7 +586,7 @@ TestPageLoader.queueTest("repetition/repetition", function (testPage) {
expect(querySelectorAll(".list5 > li").length).toBe(2);

expect(querySelectorAll(".list5 > li:nth-child(2) > ul.list5a > li").length).toBe(5);
var list5a = testPage.evaluateNode("//*[@class='list5']/li[2]/ul[@class='list5a']");
var list5a = testPage.evaluateNode("//*[@class='list5 montage-Repetition']/li[2]/ul[@class='list5a montage-Repetition']");
expect(list5a.querySelectorAll("li").length).toBe(5);
var inputs = list5a.querySelectorAll("input");
expect(inputs.length).toBe(5);
Expand Down
4 changes: 2 additions & 2 deletions test/spec/ui/substitution-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ TestPageLoader.queueTest("substitution-test/substitution-test", function (testPa
substitution.switchValue = "two";

testPage.waitForComponentDraw(substitution).then(function () {
expect(substitution._switchElements.one.className).toBe("Foo");
expect(substitution._switchElements.one.className).toBe("Foo montage-tests-Foo");
}).finally(function () {
done();
});
Expand All @@ -156,7 +156,7 @@ TestPageLoader.queueTest("substitution-test/substitution-test", function (testPa
substitution.switchValue = "one";

testPage.waitForComponentDraw(substitution).then(function () {
expect(substitution.element.children[0].className).toBe("Foo");
expect(substitution.element.children[0].className).toBe("Foo montage-tests-Foo");
}).finally(function () {
done();
});
Expand Down
1 change: 0 additions & 1 deletion ui/base/abstract-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ var AbstractButton = exports.AbstractButton = AbstractControl.specialize( /** @l
}
}

//this.classList.add("montage-Button");
this.element.setAttribute("role", "button");
this.element.addEventListener("keyup", this, false);
}
Expand Down
3 changes: 0 additions & 3 deletions ui/base/abstract-toggle-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ var AbstractToggleButton = exports.AbstractToggleButton = AbstractControl.specia
this._keyComposer.keys = "space";
this.addComposer(this._keyComposer);

this.classList.add("montage-ToggleButton");

this.defineBindings({
// classList management
"classList.has('montage--disabled')": {
Expand Down Expand Up @@ -346,4 +344,3 @@ var AbstractToggleButton = exports.AbstractToggleButton = AbstractControl.specia
}

});

1 change: 0 additions & 1 deletion ui/button.reel/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,6 @@ var Button = exports.Button = Control.specialize(/** @lends module:"montage/ui/n
// }
}

//this.classList.add("montage-Button");
this.element.setAttribute("role", "button");
this.element.addEventListener("keyup", this, false);
}
Expand Down
14 changes: 14 additions & 0 deletions ui/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -2046,6 +2046,20 @@ var Component = exports.Component = Target.specialize(/** @lends Component.proto
this._treeLevel = level;
if (firstDraw) {
this.originalElement = this.element;

if (this !== this.rootComponent) {
var moduleInfo = Montage.getInfoForObject(this),
packageName = moduleInfo.require.packageDescription.name,
objectName = moduleInfo.objectName;

if (
objectName && packageName &&
((packageName === "montage" && objectName !== "Component") ||
(packageName !== "montage"))
) {
this.classList.add(packageName + "-" + objectName);
}
}
}
if (this.needsDraw) {
this.rootComponent.addToDrawCycle(this);
Expand Down
10 changes: 1 addition & 9 deletions ui/slot.reel/slot.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,7 @@ exports.Slot = Component.specialize( /** @lends Slot.prototype # */ {
_content: {
value: null
},

enterDocument:{
value:function (firstTime) {
if (firstTime) {
this.element.classList.add("montage-Slot");
}
}
},


/**
* The component that resides in this slot and in its place in the
* template.
Expand Down
2 changes: 0 additions & 2 deletions ui/substitution.reel/substitution.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ exports.Substitution = Slot.specialize( /** @lends Substitution.prototype # */ {
value: function (firstTime) {
var argumentNames;

Slot.prototype.enterDocument.apply(this, arguments);

if (firstTime) {
argumentNames = this.getDomArgumentNames();
for (var i = 0, name; (name = argumentNames[i]); i++) {
Expand Down
1 change: 0 additions & 1 deletion ui/text.reel/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ var MontageText = exports.Text = Component.specialize( /** @lends module:montag
range.deleteContents();
this._valueNode = document.createTextNode("");
range.insertNode(this._valueNode);
this.element.classList.add("montage-Text");
}
}
},
Expand Down