You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by ev...@apache.org on 2008/10/02 18:22:28 UTC
svn commit: r701175 - in
/incubator/shindig/trunk/features/opensocial-templates: compiler.js
loader_test.js ost_test.html template_test.js
Author: evan
Date: Thu Oct 2 09:22:26 2008
New Revision: 701175
URL: http://svn.apache.org/viewvc?rev=701175&view=rev
Log:
SHINDIG-630 - Enable JsUnit tests for non-Firefox browsers
Modified:
incubator/shindig/trunk/features/opensocial-templates/compiler.js
incubator/shindig/trunk/features/opensocial-templates/loader_test.js
incubator/shindig/trunk/features/opensocial-templates/ost_test.html
incubator/shindig/trunk/features/opensocial-templates/template_test.js
Modified: incubator/shindig/trunk/features/opensocial-templates/compiler.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-templates/compiler.js?rev=701175&r1=701174&r2=701175&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-templates/compiler.js (original)
+++ incubator/shindig/trunk/features/opensocial-templates/compiler.js Thu Oct 2 09:22:26 2008
@@ -363,7 +363,8 @@
// where they can be accessed as objects, rather than placing them
// into attributes where they need to be serialized.
outName = '.' + outName;
- } else if (os.isIe && outName.substring(0, 2).toLowerCase() == 'on') {
+ } else if (os.isIe && !os.customAttributes_[outName] &&
+ outName.substring(0, 2).toLowerCase() == 'on') {
// For event handlers on IE, setAttribute doesn't work, so we need
// to create a function to set as a property.
outName = '.' + outName;
@@ -394,7 +395,8 @@
// The cssText property of the style object must be set instead.
to.style.cssText = value;
}
- if (os.isIe && outName.substring(0, 2).toLowerCase() == 'on') {
+ if (os.isIe && !os.customAttributes_[outName] &&
+ outName.substring(0, 2).toLowerCase() == 'on') {
// In IE, setAttribute doesn't create event handlers, so we must
// use attachEvent in order to create handlers that are preserved
// by calls to cloneNode().
Modified: incubator/shindig/trunk/features/opensocial-templates/loader_test.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-templates/loader_test.js?rev=701175&r1=701174&r2=701175&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-templates/loader_test.js (original)
+++ incubator/shindig/trunk/features/opensocial-templates/loader_test.js Thu Oct 2 09:22:26 2008
@@ -115,7 +115,9 @@
var rules = sheets[i].cssRules || sheets[i].rules;
if (rules) {
for (var j = 0; j < rules.length; ++j) {
- if (rules[j].selectorText == name) {
+ if (rules[j].selectorText == name
+ //hack for WebKit Quirks mode
+ || rules[j].selectorText == name.toLowerCase()) {
return rules[j];
}
}
Modified: incubator/shindig/trunk/features/opensocial-templates/ost_test.html
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-templates/ost_test.html?rev=701175&r1=701174&r2=701175&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-templates/ost_test.html (original)
+++ incubator/shindig/trunk/features/opensocial-templates/ost_test.html Thu Oct 2 09:22:26 2008
@@ -41,6 +41,21 @@
<script type="text/javascript" src="os_test.js"></script>
<script type="text/javascript" src="util_test.js"></script>
<script type="text/javascript" src="template_test.js"></script>
+ <!-- JsUnit work-around for non-FireFox browsers -->
+ <script type="text/javascript">
+ function exposeTestFunctionNames() {
+ var testSource = typeof RuntimeObject != 'undefined' ?
+ RuntimeObject('test' + '*') : self;
+ var testFunctionNames = new Array();
+ for (i in testSource) {
+ if (i.substring(0, 4) == 'test' && typeof(testSource[i]) == 'function')
+ push(testFunctionNames, i);
+ }
+ return testFunctionNames;
+ }
+
+ os.createNamespace("test", "http://www.google.com/#test");
+ </script>
</head>
<body>
<script type="text/os-template" tag="os:Test">tag template</script>
@@ -60,9 +75,6 @@
</div>
</div>
- <xmp id="_T_Substitution_text" style="display: none">${title}:${value}</xmp>
-
- <xmp id="_T_Substitution_text" style="display: none">${title}:${value}</xmp>
<xmp id="_T_Substitution_attribute" style="display: none">
<button id="${id}" style="color: ${color}" a1="value ${A1}">${text}</button>
</xmp>
Modified: incubator/shindig/trunk/features/opensocial-templates/template_test.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-templates/template_test.js?rev=701175&r1=701174&r2=701175&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-templates/template_test.js (original)
+++ incubator/shindig/trunk/features/opensocial-templates/template_test.js Thu Oct 2 09:22:26 2008
@@ -137,7 +137,7 @@
lhs = normalizeNodeOrMarkup(lhs);
rhs = normalizeNodeOrMarkup(rhs);
- assertEquals('DOM nodes not equal: \n_ ' + lhs + '\n_ ' + rhs, lhs, rhs);
+ assertEquals(lhs, rhs);
}
@@ -206,10 +206,9 @@
title: "count",
value: 0
};
- var outputNode = compileAndRender_("_T_Substitution_text", data);
-
- assertEquals(data.title + ":" + data.value,
- domutil.getVisibleText(outputNode));
+ assertTemplateOutput('<div>${title}:${value}</div>',
+ '<div>' + data.title + ":" + data.value + '</div>',
+ data);
}
function testSubstitution_attribute() {
@@ -730,11 +729,9 @@
};
function testOnAttachAttribute() {
- /* fails on IE.
var template = os.compileTemplateString(
'<div onAttach="this.title=\'bar\'"/>');
var output = document.createElement('div');
template.renderInto(output);
assertEquals('bar', output.firstChild.title);
- */
};