A passing test.

This commit is contained in:
Tim Schaub
2012-06-19 11:14:53 +02:00
parent b1e26fab1d
commit 77c07a500e
6 changed files with 26 additions and 35 deletions

14
main.js
View File

@@ -1,14 +0,0 @@
goog.provide('ol');
goog.require('ol.map');
goog.require('goog.dom');
var map;
ol.main = function() {
goog.dom.getElement('output').innerHTML = 'test';
map = ol.map().center([45, 5]);
};
window['main'] = ol.main;
goog.exportSymbol('map', map);

View File

@@ -1,15 +1,11 @@
{
"id": "main",
"id": "ol",
"inputs": "main.js",
"inputs": "src/ol.js",
"paths": [
"."
],
"externs": [
"//google_maps_api_v3.js"
],
"define": {
// "goog.dom.ASSUME_STANDARDS_MODE": true,
"goog.DEBUG": true

View File

@@ -15,20 +15,25 @@ ol.ProjectionLike;
* @return {ol.Projection} Projection.
*/
ol.projection = function(opt_arg){
var code;
if (arguments.length == 1) {
var code, units;
if (arguments.length == 1 && goog.isDef(opt_arg)) {
if (opt_arg instanceof ol.Projection) {
return opt_arg;
}
else
if (goog.isString(arguments[0])) {
code = arguments[0];
}
else {
throw new Error('ol.projection');
}
else if (goog.isString(opt_arg)) {
code = opt_arg;
}
else if (goog.isObject(opt_arg)) {
code = opt_arg['code'];
units = opt_arg['units'];
}
else {
throw new Error('ol.projection');
}
}
return new ol.Projection(code);
var proj = new ol.Projection();
proj.setCode(code);
return proj;
};

4
src/ol.js Normal file
View File

@@ -0,0 +1,4 @@
goog.provide("ol");
goog.require("ol.map");
goog.require("ol.loc");
goog.require("ol.projection");

View File

@@ -9,10 +9,7 @@
<script type="text/javascript" src="jasmine-1.2.0/jasmine-html.js"></script>
<!-- include source files here... -->
<script type="text/javascript" src="../src/ol/Bounds.js"></script>
<script type="text/javascript" src="../src/ol/Location.js"></script>
<script type="text/javascript" src="../src/ol/Map.js"></script>
<script type="text/javascript" src="../src/ol/Projection.js"></script>
<script type="text/javascript" src="http://localhost:9810/compile?id=ol&amp;mode=RAW"></script>
<!-- include spec files here... -->
<script type="text/javascript" src="spec/ol/Bounds.test.js"></script>

View File

@@ -6,7 +6,10 @@ describe("ol.Projection", function() {
p = ol.projection("foo");
expect(p.code()).toBe("foo");
p = ol.projection({code: "bar"});
p = ol.projection({
code: "bar",
units: "m"
});
expect(p.code()).toBe("bar");
});