Skip to content

Commit

Permalink
Fixes #2532701 - Added better filtering to Y.guid with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davglass committed Sep 18, 2012
1 parent bb6652d commit 1ab575f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/yui/js/yui.js
Expand Up @@ -425,7 +425,7 @@ proto = {
if (G_ENV && Y !== YUI) {
Env._yidx = ++G_ENV._yidx;
Env._guidp = ('yui_' + VERSION + '_' +
Env._yidx + '_' + time).replace(/\./g, '_').replace(/-/g, '_');
Env._yidx + '_' + time).replace(/[^a-z0-9_]+/g, '_');
} else if (YUI._YUI) {

G_ENV = YUI._YUI.Env;
Expand Down
12 changes: 12 additions & 0 deletions src/yui/tests/unit/assets/core-tests.js
Expand Up @@ -750,6 +750,18 @@ YUI.add('core-tests', function(Y) {
});

test.wait();
},
'test y.guid': function() {
//I can't add tests for this because the API is screwed so I'm adding logical tests with my code update
var time = new Date().getTime(),
myY = YUI(),
idx = myY.Env.yidx,
version = '3.5.0-2pre+';
//This is what Y.Env._guidp should be if Y.version is '3.5.0-2pre+'
myY.Env._guidp = ('yui_' + version + '_' + idx + '_' + time).replace(/[^a-z0-9_]+/g, '_');
Y.Assert.areEqual('yui_3_5_0_2pre__' + idx + '_' + time, myY.Env._guidp);
Y.Assert.areEqual('yui_3_5_0_2pre__' + idx + '_' + time + '_2', myY.guid());
Y.Assert.areEqual('yui_3_5_0_2pre__' + idx + '_' + time + '_3', myY.guid());
}
});

Expand Down

0 comments on commit 1ab575f

Please sign in to comment.