Skip to content

Commit

Permalink
Normalize YUI config for tests. filter from url.
Browse files Browse the repository at this point in the history
Use the query string filter={raw|debug} to override
min default filter applied to YUI config.
  • Loading branch information
lsmith committed Apr 19, 2011
1 parent d1522e2 commit c77d701
Show file tree
Hide file tree
Showing 20 changed files with 86 additions and 93 deletions.
6 changes: 2 additions & 4 deletions src/arraysort/tests/arraysort.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ <h1>ArraySort Tests</h1>
<script type="text/javascript">
(function() {
YUI({
base: "../../../build/",
filters: {arraysort:"debug"},
logInclude:{"TestRunner":true},
useConsole: true
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
allowRollup: false
}).use("console", "test", "dump", "arraysort", function(Y) {

// Set up the page
Expand Down
5 changes: 3 additions & 2 deletions src/async-queue/tests/async-queue.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
<script src="async-queue-tests.js"></script>
<script>
YUI({
filter: 'raw',
useBrowserConsole: false
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
useBrowserConsole: false,
allowRollup: false
}).use('console-filters', 'async-queue-tests', function (Y) {

new Y.Console({
Expand Down
5 changes: 3 additions & 2 deletions src/collection/tests/arraylist.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
<script src="arraylist-tests.js"></script>
<script>
YUI({
filter: 'raw',
useBrowserConsole: false
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
useBrowserConsole: false,
allowRollup: false
}).use('console-filters', 'arraylist-tests', function (Y) {

new Y.Console({
Expand Down
5 changes: 4 additions & 1 deletion src/console-filters/tests/console-filters.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
<script src="../../../build/yui/yui.js"></script>
<script src="console-filters-tests.js"></script>
<script>
YUI({ filter : 'raw' }).use('test','console-filters-tests', function (Y) {
YUI({
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
allowRollup: false
}).use('test','console-filters-tests', function (Y) {

var yconsole = new Y.Console({ boundingBox:"#log", newestOnTop: false }).
plug(Y.Plugin.ConsoleFilters).
Expand Down
12 changes: 4 additions & 8 deletions src/console/tests/console.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@

<div id="log"></div>
<script src="../../../build/yui/yui.js"></script>
<script src="console-tests.js"></script>
<script>
YUI({
filter: 'raw',
modules: {
'console-test': {
fullpath: 'testsuite.js',
requires: ['console-filters','test']
}
},
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
allowRollup: false,
useBrowserConsole: false
}).use('console-filters', 'console-test', function (Y) {
}).use('console-filters', 'console-tests', function (Y) {

new Y.Console({
style: 'block',
Expand Down
7 changes: 3 additions & 4 deletions src/dataschema/tests/dataschema-perf.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ <h1>DataSchema Performance Tests</h1>

<script type="text/javascript">
YUI({
base: "../../../build/",
filter: "debug",
logInclude:{"perf":true, "dataschema-json":true, "dataschema-xml":true},
useConsole: true
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
allowRollup: false,
useBrowserConsole: false
}).use("console", "profiler", "dump", "datatype", "dataschema", function(Y) {

// Set up the page
Expand Down
8 changes: 3 additions & 5 deletions src/dataschema/tests/dataschema.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<head>
<title>DataSchema Tests</title>
<script type="text/javascript" src="../../../build/yui/yui.js"></script>
<script type="text/javascript" src="../../../build/dataschema/dataschema-debug.js"></script>
</head>

<body class="yui3-skin-sam">
Expand Down Expand Up @@ -49,10 +48,9 @@ <h1>DataSchema Tests</h1>

(function() {
YUI({
base: "../../../build/",
filter: "raw",
logInclude:{"TestRunner":true},
useConsole: true
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
allowRollup: false,
useBrowserConsole: false
}).use("console", "test", "dump", "dataschema", "datatype", function(Y) {

// Set up the page
Expand Down
7 changes: 3 additions & 4 deletions src/datasource/tests/datasource-perf.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ <h1>DataSource Performance Tests</h1>
<script type="text/javascript">
(function() {
YUI({
base: "../../../build/",
filter: "debug",
logInclude:{"perf":true},
useConsole: true
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
allowRollup: false,
useBrowserConsole: false
}).use("console", "profiler", "dump", "datasource", function(Y) {

// Set up the page
Expand Down
8 changes: 3 additions & 5 deletions src/datasource/tests/datasource.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<head>
<title>DataSource Tests</title>
<script type="text/javascript" src="../../../build/yui/yui.js"></script>
<script type="text/javascript" src="../../../build/datasource/datasource-debug.js"></script>
</head>

<body class="yui3-skin-sam">
Expand All @@ -14,10 +13,9 @@ <h1>DataSource Tests</h1>

(function() {
YUI({
base: "../../../build/",
filter: "raw",
logInclude:{"TestRunner":true,"datasource":true},
useConsole: true
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
allowRollup: false,
useBrowserConsole: true
}).use("dump", "test", "console", "io-base", "cache", "base", "plugin", "json", "datatype", "dataschema", "datasource", function(Y) {

var ASSERT = Y.Assert,
Expand Down
7 changes: 3 additions & 4 deletions src/datatable/tests/datatable-manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,9 @@ <h3>Scrolling Datatable with Big Headers</h3>

(function() {
YUI({
base: "../../../build/",
filter: "debug",
logInclude:{"TestRunner":true},
useConsole: true
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
allowRollup: false,
useBrowserConsole: true
}).use("console", "test", "dump", "datatable","node","json-parse", function(Y) {


Expand Down
7 changes: 3 additions & 4 deletions src/datatable/tests/datatable.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,9 @@ <h3>Scrolling Datatable with no width or height set</h3>

(function() {
YUI({
base: "../../../build/",
filter: "debug",
logInclude:{"TestRunner":true},
useConsole: true
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
allowRollup: false,
useBrowserConsole: false
}).use("console", "test", "dump", "datatable", "profiler","node","json-parse", function(Y) {


Expand Down
6 changes: 4 additions & 2 deletions src/datatable/tests/performance.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@

<div id="node"></div>

<script src="http://localhost:8888/yui3/build/yui/yui-debug.js"></script>
<script src="../../../build/yui/yui.js"></script>

<script>
var Y = YUI({filter:'raw'}).use('node', function(Y) {
var Y = YUI({
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min'
}).use('node', function(Y) {
YNode = Y.Node;
YSub = Y.Lang.sub;

Expand Down
3 changes: 2 additions & 1 deletion src/event/tests/event-synthetic.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
<script src="event-synthetic-tests.js"></script>
<script>
YUI({
filter: 'raw',
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
allowRollup: false,
lazyEventFacade: true,
useBrowserConsole: false
})
Expand Down
3 changes: 2 additions & 1 deletion src/json/tests/json.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<script src="json-stringify-tests.js"></script-->
<script>
YUI({
filter: 'raw',
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
allowRollup: false,
useBrowserConsole: false
}).use('console-filters', 'json-tests', function (Y) {

Expand Down
3 changes: 2 additions & 1 deletion src/jsonp/tests/jsonp.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ <h2>jsonp-url tests</h2>
<script src="jsonp-url-tests.js"></script>
<script>
YUI({
filter: 'raw',
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
allowRollup: false,
useBrowserConsole: false
}).use('console-filters', 'jsonp-tests', function (Y) {

Expand Down
72 changes: 34 additions & 38 deletions src/pluginattr/js/attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var Lang = Y.Lang,
* configuration, override the setter. To have attribute access respond
* with more useful (truthy) data, override the getter.</p>
*
* <p>Note: the setter should return the plugin class or
* <p>Note: the setter should return the plugin instance or
* <code>Y.Attribute.INVALID_VALUE</code>.</p>
*
* <pre><code>
Expand All @@ -34,8 +34,6 @@ var Lang = Y.Lang,
* var plugin = Y.Attribute.INVALID_VALUE;
*
* if (attr.indexOf('.') === -1) {
* plugin = Y.ConsoleFilters;
*
* if (Y.Lang.isString(val) || Y.Lang.isArray(val)) {
* var cats = Y.Array.hash(Y.Array(val));
* val = {
Expand All @@ -46,10 +44,12 @@ var Lang = Y.Lang,
*
* if (val !== false) {
* val = (Y.Lang.isObject(val)) ? val : {};
* this.plug(plugin, val);
* this.plug(Y.Plugin.ConsoleFilters, val);
* } else {
* this.unplug(plugin);
* this.unplug(Y.Plugin.ConsoleFilters);
* }
*
* plugin = this[Y.Plugin.ConsoleFilters.NS];
* }
*
* return plugin;
Expand All @@ -69,46 +69,42 @@ var Lang = Y.Lang,
* @param {Boolean} force Redefine the existing host attribue if found
*/
Y.Plugin.addHostAttr = function (name, host, plugin, force) {
if (isString(name) && isObject(host) && isObject(plugin)) {
var attrDef = { lazyAdd: false };

if (isFunction(plugin)) {
attrDef.setter = function (val, attr) {
var method = (val !== false) ? 'plug' : 'unplug',
ret = Y.Attribute.INVALID_VALUE,
conf = (isObject(val)) ? val : {};
if (!isString(name) || !isObject(host) || !isObject(plugin)) {
return false;
}

// For now, disallow subattribute as a trigger or
// plugin attribute setter
if (attr.indexOf('.') === -1) {
ret = plugin;
var attrDef = { lazyAdd: false };

conf.host = this;
if (isFunction(plugin)) {
attrDef.setter = function (val, attr) {
var method = (val !== false) ? 'plug' : 'unplug',
ret = Y.Attribute.INVALID_VALUE,
conf = (isObject(val)) ? val : {};

this[method](plugin, conf);
}
// For now, disallow subattribute as a trigger or
// plugin attribute setter
if (attr.indexOf('.') === -1) {
conf.host = this;

return ret;
};
attrDef.getter = function () {
// TODO: Or return config state as object literal?
return this[plugin.NS];
};
} else {
Y.mix(attrDef, plugin, true);
}
this[method](plugin, conf);

if (isFunction(host)) {
if (host.ATTRS && (force || !host.ATTRS[name])) {
host.ATTRS[name] = attrDef;
ret = this[plugin.NS];
}
} else if (host.constructor.ATTRS && host.addAttr &&
host._state && (force || !host.attrAdded(name))) {
host.addAttr(name, attrDef, false);
}

return true;
return ret;
};
} else {
Y.mix(attrDef, plugin, true);
}

if (isFunction(host)) {
if (host.ATTRS && (force || !host.ATTRS[name])) {
host.ATTRS[name] = attrDef;
}
} else if (host.constructor.ATTRS && host.addAttr &&
host._state && (force || !host.attrAdded(name))) {
host.addAttr(name, attrDef, false);
}

return false;
return true;
};
3 changes: 2 additions & 1 deletion src/pluginattr/tests/pluginattr.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<script src="pluginattr-tests.js"></script>
<script>
YUI({
filter: 'raw',
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
allowRollup: false,
useBrowserConsole: false
}).use('console-filters', 'pluginattr-tests', function (Y) {

Expand Down
6 changes: 2 additions & 4 deletions src/recordset/tests/recordset.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ <h1>Recordset Tests</h1>
<script type="text/javascript">
(function() {
YUI({
base: "../../../build/",
filter: "debug",
logInclude:{"TestRunner":true},
useConsole: true
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
allowRollup: false
}).use("console", "test", "dump", "recordset", function(Y) {


Expand Down
3 changes: 2 additions & 1 deletion src/slider/tests/slider.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
<script src="slider-tests.js"></script>
<script>
YUI({
filter: 'raw',
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
allowRollup: false,
useBrowserConsole: false
}).use('console-filters', 'slider-tests', function (Y) {

Expand Down
3 changes: 2 additions & 1 deletion src/stylesheet/tests/stylesheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
<script src="stylesheet-tests.js"></script>
<script>
YUI({
filter: 'raw',
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
allowRollup: false,
useBrowserConsole: false
}).use('console-filters', 'stylesheet-tests', function (Y) {

Expand Down

0 comments on commit c77d701

Please sign in to comment.