From bc87c3fa467683a017a9d171eeccd70970e2a006 Mon Sep 17 00:00:00 2001 From: Adam Krebs Date: Tue, 27 Nov 2012 11:22:19 -0500 Subject: [PATCH] add options function test --- test/view.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/view.js b/test/view.js index fa0a9743..400c80eb 100644 --- a/test/view.js +++ b/test/view.js @@ -165,6 +165,30 @@ $(document).ready(function() { strictEqual(new View().el.id, 'id'); }); + test("with options function", 3, function() { + var View1 = Backbone.View.extend({ + options: function() { + return { + title: 'title1', + acceptText: 'confirm' + } + } + }); + + var View2 = View1.extend({ + options: function() { + return _.extend(View1.prototype.options.call(this), { + title: 'title2', + fixed: true + }); + } + }); + + strictEqual(new View2().options.title, 'title2'); + strictEqual(new View2().options.acceptText, 'confirm'); + strictEqual(new View2().options.fixed, true); + }); + test("with attributes", 2, function() { var View = Backbone.View.extend({ attributes: {