From dd5114395ad56ac7a7142c9c3463a1867120e326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Blais=20Masson?= Date: Wed, 11 Apr 2012 20:16:44 -0400 Subject: [PATCH 1/4] Missing semi-colons --- public/js/lib/views/arrow_configuration_view.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/js/lib/views/arrow_configuration_view.js b/public/js/lib/views/arrow_configuration_view.js index ae36bca..0f92710 100644 --- a/public/js/lib/views/arrow_configuration_view.js +++ b/public/js/lib/views/arrow_configuration_view.js @@ -97,10 +97,10 @@ if (!('CSSArrowPlease' in window)) window.CSSArrowPlease = {}; var target = $(ev.currentTarget), val = parseInt(target.val()), increment = ev.keyCode == 38 ? 1 : -1, - multiply = ev.shiftKey ? 10 : 1 + multiply = ev.shiftKey ? 10 : 1; target.val(val + increment * multiply); - this._updateModel(ev) + this._updateModel(ev); } }; From 766a0567b82835f102466644ef450e885fc0fa49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Blais=20Masson?= Date: Wed, 11 Apr 2012 20:24:25 -0400 Subject: [PATCH 2/4] =?UTF-8?q?Don=E2=80=99t=20allow=20negative=20values?= =?UTF-8?q?=20for=20Size=20and=20Border=20width?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/lib/views/arrow_configuration_view.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/public/js/lib/views/arrow_configuration_view.js b/public/js/lib/views/arrow_configuration_view.js index 0f92710..1d48470 100644 --- a/public/js/lib/views/arrow_configuration_view.js +++ b/public/js/lib/views/arrow_configuration_view.js @@ -97,9 +97,12 @@ if (!('CSSArrowPlease' in window)) window.CSSArrowPlease = {}; var target = $(ev.currentTarget), val = parseInt(target.val()), increment = ev.keyCode == 38 ? 1 : -1, - multiply = ev.shiftKey ? 10 : 1; + multiply = ev.shiftKey ? 10 : 1 + newVal = val + increment * multiply; - target.val(val + increment * multiply); + if (newVal < 0) newVal = 0; + + target.val(newVal); this._updateModel(ev); } From 9d6f6dd952108739ff393d775ba3aa55038a6ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Blais=20Masson?= Date: Wed, 11 Apr 2012 20:44:34 -0400 Subject: [PATCH 3/4] Spec for preventing negative values for Size and Border width --- public/js/spec/views/arrow_configuration_view_spec.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/public/js/spec/views/arrow_configuration_view_spec.js b/public/js/spec/views/arrow_configuration_view_spec.js index a6388dc..70731d6 100644 --- a/public/js/spec/views/arrow_configuration_view_spec.js +++ b/public/js/spec/views/arrow_configuration_view_spec.js @@ -87,12 +87,15 @@ describe("CSSArrowPlease.ArrowConfigurationView", function () { arrowAttr = object.arrowAttr; $.each(keystrokes, function (i, keystroke) { - var keydown = $.Event('keydown') + var keydown = $.Event('keydown'), + expectedVal = defaultVal + keystroke.increment; keydown.keyCode = keystroke.key; keydown.shiftKey = keystroke.shift; elem.val(defaultVal).trigger(keydown); - expect( arrow.get(arrowAttr) ).toEqual(defaultVal + keystroke.increment); + + if (expectedVal < 0) expectedVal = 0; + expect( arrow.get(arrowAttr) ).toEqual(expectedVal); }); }); }); From a76930ce50f405e217a243f4fce678e3cacc3baf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Blais=20Masson?= Date: Thu, 12 Apr 2012 10:25:17 -0400 Subject: [PATCH 4/4] Missing comma --- public/js/lib/views/arrow_configuration_view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/lib/views/arrow_configuration_view.js b/public/js/lib/views/arrow_configuration_view.js index 1d48470..eb45e04 100644 --- a/public/js/lib/views/arrow_configuration_view.js +++ b/public/js/lib/views/arrow_configuration_view.js @@ -97,7 +97,7 @@ if (!('CSSArrowPlease' in window)) window.CSSArrowPlease = {}; var target = $(ev.currentTarget), val = parseInt(target.val()), increment = ev.keyCode == 38 ? 1 : -1, - multiply = ev.shiftKey ? 10 : 1 + multiply = ev.shiftKey ? 10 : 1, newVal = val + increment * multiply; if (newVal < 0) newVal = 0;