mirror of
https://github.com/RustyRaptor/brackets.git
synced 2026-12-04 00:15:22 -07:00
add more code hint tests for html file and module file
This commit is contained in:
1 parent
2ddcf52d49
commit
bd4feb5611
8 files changed
+351
-12
No files matched your search
+11
-4
@@ -6,8 +6,9 @@
|
||||
</head>
|
||||
<body>
|
||||
<script src="file1.js"></script>
|
||||
<script src="file2.js"></script>
|
||||
<script>
|
||||
var x = "hi";
|
||||
var x100 = "hi";
|
||||
</script>
|
||||
some stuff
|
||||
|
||||
@@ -17,19 +18,25 @@
|
||||
</div>
|
||||
<script>
|
||||
function foo(a){
|
||||
var y = x100;
|
||||
k = a;
|
||||
funD("test", 100);
|
||||
funE(D1, A2.propA);
|
||||
return "hi";
|
||||
}
|
||||
var k = 100;
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.style:hover { color: rgba(153, 102, 51, 0.63); }
|
||||
</style>
|
||||
some other stuff
|
||||
<div class = "content">
|
||||
</div>
|
||||
|
||||
<script>
|
||||
foo(10);
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,7 @@
|
||||
/*jslint vars: true, plusplus: true, devel: true, browser: true, nomen: true, indent: 4, maxerr: 50 */
|
||||
/*global define, $ */
|
||||
define(function (require, exports, module) {
|
||||
"use strict";
|
||||
exports.name = "Honda";
|
||||
exports.model = "2013 MDX";
|
||||
});
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
/*jslint vars: true, plusplus: true, devel: true, browser: true, nomen: true, indent: 4, maxerr: 50 */
|
||||
/*global define, $ */
|
||||
define(function () {
|
||||
'use strict';
|
||||
return {
|
||||
getCredits: function () {
|
||||
var credits = "100";
|
||||
return credits;
|
||||
}
|
||||
};
|
||||
});
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
/*jslint vars: true, plusplus: true, devel: true, browser: true, node: true, nomen: true, indent: 4, maxerr: 50 */
|
||||
/*global brackets, define, require, $ */
|
||||
define(function (require, exports, module) {
|
||||
'use strict';
|
||||
|
||||
var moduleName = (function () {
|
||||
// this becomes public due to the reference exposure in the return below
|
||||
var addMessage = function (test) {
|
||||
this.publicMethod1(); // a test here to check the method showing
|
||||
};
|
||||
|
||||
var name = "new name";
|
||||
|
||||
// this is the "revealed" part of the module
|
||||
return {
|
||||
addMessage: addMessage,
|
||||
name: name
|
||||
};
|
||||
}());
|
||||
moduleName.publicMethod1 = function () { // test for methods:name, addMessage, publicMethod1, priv
|
||||
};
|
||||
|
||||
// extending a new module
|
||||
var extendedModule = (function (oldModule) {
|
||||
var parent = oldModule;
|
||||
|
||||
parent.privilegedMethod = function () {
|
||||
};
|
||||
|
||||
var privateMethod2 = function () {
|
||||
// test parent. make sure all methods defined in moduleName showing up here
|
||||
};
|
||||
return {
|
||||
newMethod : function () {
|
||||
// should see methods for oldModule oldModule., parent.
|
||||
// should see privateMethod2(
|
||||
}
|
||||
};
|
||||
}(moduleName || {}));//Module object is the existing module to extend.
|
||||
|
||||
// test here: check extendedModule
|
||||
|
||||
moduleName.addMessage("test");
|
||||
moduleName.name = " new name";
|
||||
|
||||
//parent module
|
||||
var SearchEngine = (function () {
|
||||
//Private Method.
|
||||
var luckyAlgo = function () {
|
||||
//create one random number.
|
||||
return Math.floor(Math.random() * 11);
|
||||
};
|
||||
//Returning the object
|
||||
return {
|
||||
//privileged method.
|
||||
getYourLuckyNumber : function () {
|
||||
//Has access to its private method because of closure.
|
||||
return luckyAlgo();
|
||||
}
|
||||
};
|
||||
}());//Self executing method.
|
||||
// test SearchEngine.getYourLuckyNumber().toExponential();
|
||||
|
||||
|
||||
SearchEngine.subSearch = (function () {
|
||||
//Private variable.
|
||||
var defaultColor = "Orange";
|
||||
//private method.
|
||||
var myColorAlgo = function (num) {
|
||||
switch (num) {
|
||||
case 1:
|
||||
defaultColor = "Green";
|
||||
break;
|
||||
}
|
||||
};
|
||||
return {
|
||||
getYourLuckyColor : function () {
|
||||
//access to private variable because of closure.
|
||||
myColorAlgo(SearchEngine.getYourLuckyNumber());
|
||||
return defaultColor;
|
||||
}
|
||||
};
|
||||
}());
|
||||
|
||||
require(["shirt"], function (myShirt) {
|
||||
// myShirt. test here
|
||||
});
|
||||
var t2 = require("shirt");
|
||||
var size = t2.size;
|
||||
var color = t2.color;
|
||||
t2.material();
|
||||
|
||||
var purchaseModule = require('purchase');
|
||||
purchaseModule.purchaseProduct();
|
||||
|
||||
var hondaCar = require('Car');
|
||||
|
||||
});
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
/*jslint vars: true, plusplus: true, devel: true, browser: true, nomen: true, indent: 4, maxerr: 50 */
|
||||
/*global define, $ */
|
||||
define(function (products) {
|
||||
'use strict';
|
||||
return {
|
||||
reserveProduct: function () {
|
||||
console.log("Function : reserveProduct");
|
||||
return true;
|
||||
}
|
||||
};
|
||||
});
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
/*jslint vars: true, plusplus: true, devel: true, browser: true, nomen: true, indent: 4, maxerr: 50 */
|
||||
/*global define, $ */
|
||||
define(["credits", "products"], function (credits, products) {
|
||||
'use strict';
|
||||
return {
|
||||
purchaseProduct: function () {
|
||||
var credit = credits.getCredits();
|
||||
if (credit > 0) {
|
||||
products.reserveProduct();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
/*jslint vars: true, plusplus: true, devel: true, browser: true, nomen: true, indent: 4, maxerr: 50 */
|
||||
/*global define, $ */
|
||||
define(function () {
|
||||
'use strict';
|
||||
return {
|
||||
color: "black",
|
||||
size: 10,
|
||||
material: function () {
|
||||
return "cotton";
|
||||
}
|
||||
};
|
||||
});
|
||||
Reference in new issue
Block a user