Skip to content

Commit

Permalink
Added rules for setSelectable, deprecated, store/Memory, warning for …
Browse files Browse the repository at this point in the history
…getObject, etc.
  • Loading branch information
danconn committed Mar 26, 2013
1 parent 3fd9531 commit 2bad4ec
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
34 changes: 31 additions & 3 deletions converter.js
Expand Up @@ -76,6 +76,7 @@ this.CONVERTER = (function () {
'dojo/_base/array': 'dojoArray',
'dojo/io/iframe': 'dojoIframe',
'dojo/_base/lang': 'dojoLang',
'dojo/_base/kernel': 'kernel',
'dojo/keys': 'keys',
'dojo/_base/event': 'dojoEvent',
'dojo/dom-style': 'domStyle',
Expand All @@ -85,6 +86,7 @@ this.CONVERTER = (function () {
'dojo/ready': 'ready',
'dojo/has': 'has',
'dojo/Stateful': 'Stateful',
'dojo/store/Memory': 'Memory',
'dijit/registry': 'dijitRegistry',
'dijit/popup': 'dijitPopup',
'dijit/focus': 'dijitFocus',
Expand Down Expand Up @@ -128,6 +130,13 @@ this.CONVERTER = (function () {
pattern: /dojo\.(isString)/g,
depend: 'dojo/_base/lang'
},
{
pattern: /dojo\.(getObject)/g,
depend: 'dojo/_base/lang',
repFn: function (all) {
warn('dojo.getObject relies on globals - refactor to make dojo.getObject unnecessary');
}
},
{
pattern: /dojo\.isIE/g,
depend: 'dojo/has',
Expand All @@ -136,6 +145,13 @@ this.CONVERTER = (function () {
addDependency(this.depend, dependNameMap[this.depend]);
return "has('ie')";
}
},{
pattern: /dojo\.isWebKit/g,
depend: 'dojo/has',
repFn: function (all) {
addDependency(this.depend, dependNameMap[this.depend]);
return "has('webkit')";
}
},
{
pattern: /dojo\.(attr)/g,
Expand All @@ -148,10 +164,18 @@ this.CONVERTER = (function () {
pattern: /dojo\.(byId)/g,
depend: 'dojo/dom'
},
{
pattern: /dojo\.(setSelectable)/g,
depend: 'dojo/dom'
},
{
pattern: /dojo\.Stateful()/g,
depend: 'dojo/Stateful'
},
{
pattern: /dojo\.store\.Memory()/g,
depend: 'dojo/store/Memory'
},
{
pattern: /dojo\.html\.(set)/g,
depend: 'dojo/html'
Expand All @@ -174,7 +198,7 @@ this.CONVERTER = (function () {
depend: 'dojo/_base/declare',
alias: 'declare',
repFn: function (all) {
//hacky work around specifically for declare, since we don't won't to replace it till the end
//hacky work around specifically for declare, since we don't want to replace it until the end
addDependency(this.depend, this.alias);
return all;
}
Expand Down Expand Up @@ -212,6 +236,10 @@ this.CONVERTER = (function () {
pattern: /dojo\.(hitch)/g,
depend: 'dojo/_base/lang'
},
{
pattern: /dojo\.(deprecated)/g,
depend: 'dojo/_base/kernel'
},
{
pattern: /dojo\.keys[\.]?([\w\.]*)/g,
depend: 'dojo/keys'
Expand Down Expand Up @@ -425,7 +453,7 @@ this.CONVERTER = (function () {
pattern: /PTO\.log([\w\.]*)/g,
repFn: function (all, rest) {
this.alias = 'log' + rest;
this.depend = 'plugin/ioc!' + toRelativePath('PTO.logging.Logger', currentPath);
this.depend = 'plugins/ioc!' + toRelativePath('PTO.logging.Logger', currentPath);
}
},
{
Expand Down Expand Up @@ -717,4 +745,4 @@ this.CONVERTER = (function () {
return fileString.replace(/dojo\.declare/g, "declare");
}
};
}());
}());
12 changes: 12 additions & 0 deletions tests/basic/expected.js
Expand Up @@ -31,6 +31,7 @@ define([
"dojo/Stateful",
"dojo/_base/array",
"dojo/_base/event",
"dojo/_base/kernel",
"dojo/_base/lang",
"dojo/_base/window",
"dojo/cookie",
Expand All @@ -46,6 +47,7 @@ define([
"dojo/keys",
"dojo/query",
"dojo/ready",
"dojo/store/Memory",
"dojo/string",
"plugin/ioc!../../logging/Logger"
], function (
Expand Down Expand Up @@ -78,6 +80,7 @@ define([
Stateful,
dojoArray,
dojoEvent,
kernel,
dojoLang,
dojoWindow,
cookie,
Expand All @@ -93,6 +96,7 @@ define([
keys,
dojoQuery,
ready,
Memory,
dojoString,
log
) {
Expand All @@ -119,6 +123,7 @@ define([
domClass.add('class');
domAttr.attr('aria');
dojoDom.byId('someId');
dojoDom.setSelectable({}, true);
domConstruct.place('' + title + '', html);
domConstruct.place('<span id="printCaseTitle" style="display: inline-block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 80%;">' +
title + '</span>', html);
Expand Down Expand Up @@ -190,6 +195,7 @@ define([

dojoLang.isString('sdfsdf');
has('ie');
has('webkit');
domGeom.getBorderExtents();
ready();
dojoWindow.body();
Expand All @@ -211,6 +217,12 @@ define([
});

new Stateful();

dojoLang.getObject();

new Memory({data: {"id": "fake"}, idProperty: "id"});

kernel.deprecated("Don't use this!", "Use that!", "2.0");
},

templateString: 'something data-dojo-attach-point="pinnedDataNodeCenter">/something' +
Expand Down
8 changes: 8 additions & 0 deletions tests/basic/input.js
Expand Up @@ -53,6 +53,7 @@ dojo.declare('PTO.widget.document.DocumentViewerLoader', [PTO.something.Thing, P
var x = new PTO.widget.ConstructorProperty();
dijit.registry.someMethod();
dijit.byId('id');
dojo.setSelectable({}, true);
dijit.byNode('node');
dojo.clone(new Sheep());
dojo.contentBox('box');
Expand Down Expand Up @@ -109,6 +110,7 @@ dojo.declare('PTO.widget.document.DocumentViewerLoader', [PTO.something.Thing, P

dojo.isString('sdfsdf');
dojo.isIE;
dojo.isWebKit;
dojo._getBorderExtents();
dojo.ready();
dojo.body();
Expand All @@ -130,6 +132,12 @@ dojo.declare('PTO.widget.document.DocumentViewerLoader', [PTO.something.Thing, P
});

new dojo.Stateful();

dojo.getObject();

new dojo.store.Memory({data: {"id": "fake"}, idProperty: "id"});

dojo.deprecated("Don't use this!", "Use that!", "2.0");
},

templateString: 'something dojoAttachPoint="pinnedDataNodeCenter">/something' +
Expand Down

0 comments on commit 2bad4ec

Please sign in to comment.