Skip to content

Commit

Permalink
Merge pull request #13546 from code-dot-org/revert-13199-set_icon_color
Browse files Browse the repository at this point in the history
Revert "Set icon color"
  • Loading branch information
islemaster committed Mar 2, 2017
2 parents 6365a5b + cefcd77 commit 5979228
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 44 deletions.
11 changes: 0 additions & 11 deletions apps/src/applab/designMode.js
Expand Up @@ -250,15 +250,6 @@ designMode.updateProperty = function (element, name, value) {
break;
case 'icon-color':
element.setAttribute('data-icon-color', value);
const imageUrl = element.getAttribute('data-canonical-image-url');
if (ICON_PREFIX_REGEX.test(imageUrl)) {
const url = assetPrefix.renderIconToString(imageUrl, element);
if (element.nodeName == "IMG") {
element.src = url;
} else {
element.style.backgroundImage = 'url(' + url + ')';
}
}
break;
case 'image':
var originalValue = element.getAttribute('data-canonical-image-url');
Expand Down Expand Up @@ -484,8 +475,6 @@ designMode.readProperty = function (element, name) {
return parseFloat(element.style.fontSize);
case 'textAlign':
return element.style.textAlign;
case 'icon-color':
return element.getAttribute('data-icon-color');
case 'image':
return element.getAttribute('data-canonical-image-url');
case 'screen-image':
Expand Down
6 changes: 1 addition & 5 deletions apps/src/applab/setPropertyDropdown.js
Expand Up @@ -42,7 +42,6 @@ var PROP_INFO = {
// it won't show up in the dropdown.
pictureImage: { friendlyName: 'image', internalName: 'picture', type: 'string' },
picture: { friendlyName: 'picture', internalName: 'picture', type: 'string', alias: true },
iconColor: { friendlyName: 'icon-color', internalName: 'icon-color', type: 'string' },
groupId: { friendlyName: 'group-id', internalName: 'groupId', type: 'string' },
checked: { friendlyName: 'checked', internalName: 'checked', type: 'boolean' },
readonly: { friendlyName: 'readonly', internalName: 'readonly', type: 'boolean' },
Expand Down Expand Up @@ -79,7 +78,6 @@ PROPERTIES[ElementType.BUTTON] = {
'fontSize',
'textAlign',
'image',
'iconColor',
'hidden'
]
};
Expand Down Expand Up @@ -159,7 +157,6 @@ PROPERTIES[ElementType.IMAGE] = {
'y',
'pictureImage',
'picture', // Since this is an alias, it is not shown in the dropdown but is allowed as a value
'iconColor',
'hidden'
]
};
Expand All @@ -176,8 +173,7 @@ PROPERTIES[ElementType.SCREEN] = {
propertyNames: [
'text',
'backgroundColor',
'screenImage',
'iconColor'
'screenImage'
]
};
PROPERTIES[ElementType.TEXT_AREA] = {
Expand Down
35 changes: 7 additions & 28 deletions apps/test/integration/levelSolutions/applab/ec_setprop.js
Expand Up @@ -31,8 +31,6 @@ module.exports = {
console.log("font-size: " + getProperty("my_button", "font-size"));
setProperty("my_button", "image", "${facebookImage}");
console.log("image: " + getProperty("my_button", "image"));
setProperty("my_button", "icon-color", "blue");
console.log("icon-color: " + getProperty("my_button", "icon-color"));
`,
runBeforeClick: function (assert) {
// add a completion on timeout since this is a freeplay level
Expand All @@ -45,7 +43,6 @@ module.exports = {
assert.equal(button.style.fontSize, '21px');

assert(/facebook_purple.png$/.test(button.getAttribute('data-canonical-image-url')));
assert(/blue/.test(button.getAttribute('data-icon-color')));

Applab.onPuzzleComplete();
});
Expand All @@ -57,8 +54,7 @@ module.exports = {
expect(debugOutput.textContent).to.contain('text-color: red\n');
expect(debugOutput.textContent).to.contain('background-color: green\n');
expect(debugOutput.textContent).to.contain('font-size: 21\n');
expect(debugOutput.textContent).to.match(/image: .*facebook_purple.png\n/);
expect(debugOutput.textContent).to.contain('icon-color: blue');
expect(debugOutput.textContent).to.match(/image: .*facebook_purple.png$/);

return true;
},
Expand All @@ -82,10 +78,7 @@ module.exports = {
setProperty("my_button", "font-size", 21);
console.log("font-size: " + getProperty("my_button", "font-size"));
setProperty("my_button", "image", "${facebookImage}");
console.log("image: " + getProperty("my_button", "image"));
setProperty("my_button", "icon-color", "blue");
console.log("icon-color: " + getProperty("my_button", "icon-color"));
`,
console.log("image: " + getProperty("my_button", "image"));`,
runBeforeClick: function (assert) {
// add a completion on timeout since this is a freeplay level
tickWrapper.runOnAppTick(Applab, 2, function () {
Expand All @@ -97,7 +90,6 @@ module.exports = {
assert.equal(button.style.fontSize, '21px');

assert(/facebook_purple.png$/.test(button.getAttribute('data-canonical-image-url')));
assert(/blue/.test(button.getAttribute('data-icon-color')));

Applab.onPuzzleComplete();
});
Expand All @@ -109,8 +101,7 @@ module.exports = {
expect(debugOutput.textContent).to.contain('text-color: red\n');
expect(debugOutput.textContent).to.contain('background-color: green\n');
expect(debugOutput.textContent).to.contain('font-size: 21\n');
expect(debugOutput.textContent).to.match(/image: .*facebook_purple.png\n/);
expect(debugOutput.textContent).to.contain('icon-color: blue');
expect(debugOutput.textContent).to.match(/image: .*facebook_purple.png$/);

return true;
},
Expand Down Expand Up @@ -203,9 +194,7 @@ step: 3`);
setProperty("my_image", "picture", "${facebookImage}");
console.log("picture: " + getProperty("my_image", "picture"));
setProperty("my_image", "hidden", true);
console.log("hidden: " + getProperty("my_image", "hidden"));
setProperty("my_image", "icon-color", "blue");
console.log("icon-color: " + getProperty("my_image", "icon-color"));`,
console.log("hidden: " + getProperty("my_image", "hidden"));`,
runBeforeClick: function (assert) {
// add a completion on timeout since this is a freeplay level
tickWrapper.runOnAppTick(Applab, 2, function () {
Expand All @@ -221,7 +210,6 @@ step: 3`);
assert.equal(image.style.top, '14px');

assert(/facebook_purple.png$/.test(image.src));
assert(/blue/.test(image.getAttribute('data-icon-color')));

// visibility is set via a class, so use getComputedStyle
assert(window.getComputedStyle(image).visibility, 'hidden');
Expand All @@ -239,7 +227,6 @@ step: 3`);
expect(debugOutput.textContent).to.contain('y: 14\n');
expect(debugOutput.textContent).to.match(/picture: .*facebook_purple.png\n/);
expect(debugOutput.textContent).to.contain('hidden: true');
expect(debugOutput.textContent).to.contain('icon-color: blue');

return true;
},
Expand All @@ -266,9 +253,7 @@ step: 3`);
setProperty("my_image", "picture", "${facebookImage}");
console.log("picture: " + getProperty("my_image", "picture"));
setProperty("my_image", "hidden", true);
console.log("hidden: " + getProperty("my_image", "hidden"));
setProperty("my_image", "icon-color", "blue");
console.log("icon-color: " + getProperty("my_image", "icon-color"));`,
console.log("hidden: " + getProperty("my_image", "hidden"));`,
runBeforeClick: function (assert) {
// add a completion on timeout since this is a freeplay level
tickWrapper.runOnAppTick(Applab, 2, function () {
Expand All @@ -284,7 +269,6 @@ step: 3`);
assert.equal(image.style.top, '14px');

assert(/facebook_purple.png$/.test(image.src));
assert(/blue/.test(image.getAttribute('data-icon-color')));

// visibility is set via a class, so use getComputedStyle
assert(window.getComputedStyle(image).visibility, 'hidden');
Expand All @@ -302,7 +286,6 @@ step: 3`);
expect(debugOutput.textContent).to.contain('y: 14\n');
expect(debugOutput.textContent).to.match(/picture: .*facebook_purple.png\n/);
expect(debugOutput.textContent).to.contain('hidden: true');
expect(debugOutput.textContent).to.contain('icon-color: blue');

return true;
},
Expand Down Expand Up @@ -417,9 +400,7 @@ step: 3`);
'<div xmlns="http://www.w3.org/1999/xhtml" id="designModeViz" class="appModern" style="display: none; width: 320px; height: 450px;"><div class="screen" tabindex="1" id="screen1" style="display: block; height: 450px; width: 320px; left: 0px; top: 0px; position: absolute; z-index: 0;"></div></div>',
xml:
`setProperty("screen1", "image", "${flappyImage}");
console.log("image: " + getProperty("screen1", "image"));
setProperty("screen1", "icon-color", "blue");
console.log("icon-color: " + getProperty("screen1", "icon-color"));`,
console.log("image: " + getProperty("screen1", "image"));`,
runBeforeClick: function (assert) {
// add a completion on timeout since this is a freeplay level
tickWrapper.runOnAppTick(Applab, 2, function () {
Expand All @@ -429,14 +410,12 @@ step: 3`);
console.log(screen.style.backgroundImage);
assert(/url\(.*flappy_promo.png['"]?\)$/.test(screen.style.backgroundImage),
'screen background image should be flappy_promo.png. Instead: '+screen.style.backgroundImage);
assert(/blue/.test(screen.getAttribute('data-icon-color')));
Applab.onPuzzleComplete();
});
},
customValidator: function (assert) {
var debugOutput = document.getElementById('debug-output');
expect(debugOutput.textContent).to.match(/image: .*flappy_promo.png\n/);
expect(debugOutput.textContent).to.contain('icon-color: blue');
expect(debugOutput.textContent).to.match(/image: .*flappy_promo.png$/);
return true;
},
expected: {
Expand Down

0 comments on commit 5979228

Please sign in to comment.