aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/spinner.js33
-rw-r--r--ui/ui.spinner.js8
2 files changed, 29 insertions, 12 deletions
diff --git a/tests/spinner.js b/tests/spinner.js
index 548d79e17..6bef26cd2 100644
--- a/tests/spinner.js
+++ b/tests/spinner.js
@@ -135,7 +135,7 @@ test("keydown on input with options", function() {
el.simulate("keydown",{keyCode:$.simulate.VK_UP})
.simulate("keyup",{keyCode:$.simulate.VK_UP});
- equals(el.val(), 60, "Stepping 10 on 50");
+ equals(el.val(), 60, "stepping 10 on 50");
el.simulate("keydown",{keyCode:$.simulate.VK_END})
.simulate("keyup",{keyCode:$.simulate.VK_END});
@@ -160,7 +160,7 @@ test("currency and decimal options", function() {
el.simulate("keydown",{keyCode:$.simulate.VK_UP})
.simulate("keyup",{keyCode:$.simulate.VK_UP});
- equals(el.val(), "$0.30", "Stepping 0.30");
+ equals(el.val(), "$0.30", "stepping 0.30");
el.simulate("keydown",{keyCode:$.simulate.VK_END})
.simulate("keyup",{keyCode:$.simulate.VK_END});
@@ -180,6 +180,27 @@ test("currency and decimal options", function() {
equals(el.val(), "-$14.00", "keydown 120 times");
+});
+
+test("decimal options", function() {
+ expect(3);
+
+ el = $("#spin").spinner({ currency:false, incremental:false, stepping:0.7 });
+
+ equals(el.val(), "0.0", "start number");
+
+ el.simulate("keydown",{keyCode:$.simulate.VK_DOWN})
+ .simulate("keyup",{keyCode:$.simulate.VK_DOWN});
+
+ equals(el.val(), "-0.7", "stepping 0.7");
+
+ for ( var i = 1 ; i<=11 ; i++ ) {
+ el.simulate("keydown",{keyCode:$.simulate.VK_UP});
+ }
+
+ el.simulate("keyup",{keyCode:$.simulate.VK_UP});
+
+ equals(el.val(), "7.0", "keydown 11 times");
});
@@ -235,19 +256,19 @@ test("mouse click on buttons", function() {
$(".ui-spinner-up").trigger("mousedown").trigger("mouseup");
- equals(el.val(), 1, "Mouse click to up");
+ equals(el.val(), 1, "mouse click to up");
$(".ui-spinner-up").trigger("dblclick");
- equals(el.val(), 2, "Mouse double click to up");
+ equals(el.val(), 2, "mouse double click to up");
$(".ui-spinner-down").trigger("mousedown").trigger("mouseup");
- equals(el.val(), 1, "Mouse click to down");
+ equals(el.val(), 1, "mouse click to down");
$(".ui-spinner-down").trigger("dblclick");
- equals(el.val(), 0, "Mouse double click to down");
+ equals(el.val(), 0, "mouse double click to down");
});
diff --git a/ui/ui.spinner.js b/ui/ui.spinner.js
index 5d322bbc1..c4820e227 100644
--- a/ui/ui.spinner.js
+++ b/ui/ui.spinner.js
@@ -14,17 +14,13 @@
$.widget('ui.spinner', {
_init: function() {
- if($.data(this.element[0], 'spinner')) return;
// check for decimals in steppinng and set _decimals as internal (needs cleaning up)
var decimals = 0;
if (this.options.stepping.toString().indexOf('.') != -1) {
var s = this.options.stepping.toString();
- decimals = s.slice(s.indexOf('.')+1, s.length).length;
+ this._decimals = s.slice(s.indexOf('.')+1, s.length).length;
}
- $.extend(this.options, {
- _decimals: decimals
- });
//Initialize needed constants
var self = this;
@@ -200,7 +196,7 @@ $.widget('ui.spinner', {
this.element[0].value = (
this.options.currency ?
$.ui.spinner.format.currency(newVal, this.options.currency) :
- $.ui.spinner.format.number(newVal, this.options._decimals)
+ $.ui.spinner.format.number(newVal, this._decimals)
);
},
able29'>backport/44533/stable29 Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
summaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/Lib/Storage/SFTPWriteStream.php
blob: b5bc3ab667dc0c6d11f9b8f9ca7d9672672b0dfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182