Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Added tests for layer switching on projection change

Mike McGann65579dff518c
diff --git a/test/proj/wv.proj.change-test.js b/test/proj/wv.proj.change-test.js
index ebee15a24..62760cf02 100644
--- a/test/proj/wv.proj.change-test.js
+++ b/test/proj/wv.proj.change-test.js
@@ -13,6 +13,7 @@ buster.testCase("wv.proj.change", {
config: null,
models: null,
+ replace: null,
setUp: function() {
this.config = {
@@ -38,17 +39,14 @@ buster.testCase("wv.proj.change", {
}
}
};
+ this.replace = this.stub();
this.models = {
date: wv.date.model(),
proj: wv.proj.model(this.config),
- layers: { replace: this.stub() }
+ layers: { replace: this.replace }
};
this.stub(wv.ui, "notify");
- this.stub(window, "$", function() {
- return {
- on: function() {}
- };
- });
+ this.stub(window, "$").returns({ on: this.stub() });
},
"Initializes with new projection": function() {
@@ -155,6 +153,27 @@ buster.testCase("wv.proj.change", {
var model = wv.proj.change(this.models);
this.models.date.select(new Date(Date.UTC(2014, 0, 1)));
buster.refute.called(wv.ui.notify);
+ },
+
+ "Change from new to old switches layers": function() {
+ var model = wv.proj.change(this.models);
+ this.models.proj.select("arctic");
+ this.models.date.select(new Date(Date.UTC(2013, 0, 1)));
+ buster.assert.calledWith(this.replace,
+ "overlays", "arctic_coastlines_3413", "arctic_coastlines");
+ buster.assert.calledWith(this.replace,
+ "overlays", "arctic_graticule_3413", "arctic_graticule");
+ },
+
+ "Change from old to new switches layers": function() {
+ this.models.proj.select("arctic");
+ this.models.date.select(new Date(Date.UTC(2013, 0, 1)));
+ var model = wv.proj.change(this.models);
+ this.models.date.select(new Date(Date.UTC(2014, 0, 1)));
+ buster.assert.calledWith(this.replace,
+ "overlays", "arctic_coastlines", "arctic_coastlines_3413");
+ buster.assert.calledWith(this.replace,
+ "overlays", "arctic_graticule", "arctic_graticule_3413");
}
});