fable 3.0.61 → 3.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fable.compatible.js +8 -6
- package/dist/fable.compatible.min.js +1 -1
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +9 -7
- package/dist/fable.min.js +2 -2
- package/dist/fable.min.js.map +1 -1
- package/package.json +3 -3
- package/source/Fable-ServiceManager.js +13 -13
- package/source/Fable.js +1 -1
- package/source/services/Fable-Service-DataGeneration.js +1 -1
- package/source/services/Fable-Service-MetaTemplate.js +1 -1
- package/source/services/Fable-Service-RestClient.js +1 -1
- package/source/services/Fable-Service-Utility.js +19 -10
- package/test/DataFormat-StringDateFormatting_tests.js +4 -4
- package/test/DataFormat-StringManipulation_tests.js +12 -12
- package/test/DataFormat-StringNumberFormatting_tests.js +3 -3
- package/test/DataFormat-StringTokenization_tests.js +5 -5
- package/test/FableOperation_tests.js +5 -5
- package/test/FableServiceManager_tests.js +27 -27
- package/test/Fable_tests.js +1 -1
- package/test/Utility_tests.js +34 -32
package/test/Utility_tests.js
CHANGED
|
@@ -36,7 +36,7 @@ suite
|
|
|
36
36
|
function()
|
|
37
37
|
{
|
|
38
38
|
testFable = new libFable();
|
|
39
|
-
let tmpTemplate = testFable.
|
|
39
|
+
let tmpTemplate = testFable.services.Utility.template('Something');
|
|
40
40
|
Expect(tmpTemplate).to.be.a('function');
|
|
41
41
|
}
|
|
42
42
|
);
|
|
@@ -46,7 +46,7 @@ suite
|
|
|
46
46
|
function()
|
|
47
47
|
{
|
|
48
48
|
testFable = new libFable();
|
|
49
|
-
let tmpTemplate = testFable.
|
|
49
|
+
let tmpTemplate = testFable.services.Utility.template('Something');
|
|
50
50
|
Expect(tmpTemplate).to.be.a('function');
|
|
51
51
|
Expect(tmpTemplate()).to.equal('Something');
|
|
52
52
|
}
|
|
@@ -57,7 +57,7 @@ suite
|
|
|
57
57
|
function()
|
|
58
58
|
{
|
|
59
59
|
testFable = new libFable();
|
|
60
|
-
let tmpTemplate = testFable.
|
|
60
|
+
let tmpTemplate = testFable.services.Utility.template('There // %> are \\ */ /* <%= Count %> things....');
|
|
61
61
|
Expect(tmpTemplate).to.be.a('function');
|
|
62
62
|
Expect(tmpTemplate({Count:1000})).to.equal('There // %> are \\ */ /* 1000 things....');
|
|
63
63
|
}
|
|
@@ -68,10 +68,10 @@ suite
|
|
|
68
68
|
function()
|
|
69
69
|
{
|
|
70
70
|
testFable = new libFable();
|
|
71
|
-
let tmpTemplate = testFable.
|
|
71
|
+
let tmpTemplate = testFable.services.Utility.template('There are so many of these things (<%= Count %> to be exact)....');
|
|
72
72
|
Expect(tmpTemplate).to.be.a('function');
|
|
73
73
|
Expect(tmpTemplate({Count:1000})).to.equal('There are so many of these things (1000 to be exact)....');
|
|
74
|
-
let tmpOtherTemplate = testFable.
|
|
74
|
+
let tmpOtherTemplate = testFable.services.Utility.template('Things count: <%= Count %>');
|
|
75
75
|
Expect(tmpOtherTemplate).to.be.a('function');
|
|
76
76
|
Expect(tmpOtherTemplate({Count:600})).to.equal('Things count: 600');
|
|
77
77
|
Expect(tmpTemplate({Count:256})).to.equal('There are so many of these things (256 to be exact)....');
|
|
@@ -79,20 +79,20 @@ suite
|
|
|
79
79
|
);
|
|
80
80
|
test
|
|
81
81
|
(
|
|
82
|
-
'Processed
|
|
82
|
+
'Processed Multiple Templates like Underscore Work With Variables and no scope leakage',
|
|
83
83
|
function()
|
|
84
84
|
{
|
|
85
85
|
testFable = new libFable();
|
|
86
|
-
testFable.
|
|
87
|
-
testFable.
|
|
86
|
+
testFable.services.Utility.buildHashedTemplate('HeadLine', '<h1><%= TitleText %> Page</h1>');
|
|
87
|
+
testFable.services.Utility.buildHashedTemplate('Slogan', '<p>Some people, like <%= Name %>, have all the fun.</p>');
|
|
88
88
|
|
|
89
89
|
// Access the low level service render function
|
|
90
|
-
Expect(testFable.
|
|
91
|
-
Expect(testFable.
|
|
90
|
+
Expect(testFable.serviceMap.Template.HeadLine.renderFunction({TitleText:'Test'})).to.equal('<h1>Test Page</h1>');
|
|
91
|
+
Expect(testFable.serviceMap.Template.Slogan.renderFunction({Name:'Jim'})).to.equal('<p>Some people, like Jim, have all the fun.</p>');
|
|
92
92
|
|
|
93
93
|
// Use the high level simpler one
|
|
94
|
-
Expect(testFable.
|
|
95
|
-
Expect(testFable.
|
|
94
|
+
Expect(testFable.services.Utility.templates.HeadLine({TitleText:'A New'})).to.equal('<h1>A New Page</h1>');
|
|
95
|
+
Expect(testFable.services.Utility.templates.Slogan({Name:'Bob'})).to.equal('<p>Some people, like Bob, have all the fun.</p>');
|
|
96
96
|
}
|
|
97
97
|
);
|
|
98
98
|
test
|
|
@@ -101,7 +101,7 @@ suite
|
|
|
101
101
|
function()
|
|
102
102
|
{
|
|
103
103
|
testFable = new libFable();
|
|
104
|
-
let tmpTemplate = testFable.
|
|
104
|
+
let tmpTemplate = testFable.services.Utility.template('There are <%= Count %> things....', {Count:1000});
|
|
105
105
|
Expect(tmpTemplate).to.equal('There are 1000 things....');
|
|
106
106
|
}
|
|
107
107
|
);
|
|
@@ -111,7 +111,7 @@ suite
|
|
|
111
111
|
function()
|
|
112
112
|
{
|
|
113
113
|
testFable = new libFable();
|
|
114
|
-
let tmpResult = testFable.
|
|
114
|
+
let tmpResult = testFable.services.Utility.extend({SomeValue:'here'});
|
|
115
115
|
Expect(tmpResult).to.have.a.property('SomeValue')
|
|
116
116
|
.that.is.a('string');
|
|
117
117
|
Expect(tmpResult.SomeValue).to.equal('here')
|
|
@@ -123,7 +123,7 @@ suite
|
|
|
123
123
|
function()
|
|
124
124
|
{
|
|
125
125
|
testFable = new libFable();
|
|
126
|
-
let tmpResult = testFable.
|
|
126
|
+
let tmpResult = testFable.services.Utility.extend({SomeValue:'here',Size:10},{Color:'Red',Size:20});
|
|
127
127
|
Expect(tmpResult).to.have.a.property('SomeValue')
|
|
128
128
|
.that.is.a('string');
|
|
129
129
|
Expect(tmpResult.SomeValue).to.equal('here');
|
|
@@ -137,7 +137,7 @@ suite
|
|
|
137
137
|
function()
|
|
138
138
|
{
|
|
139
139
|
testFable = new libFable();
|
|
140
|
-
let tmpResult = testFable.
|
|
140
|
+
let tmpResult = testFable.services.Utility.extend(
|
|
141
141
|
{SomeValue:'here',Size:10, Race:'Human'},
|
|
142
142
|
{Color:'Red',Size:20, Band:'Metalocalypse'},
|
|
143
143
|
{Name:'Bilbo', Size:15, Race:'Hobbit', Band:'The dead hobbitz'});
|
|
@@ -165,20 +165,20 @@ suite
|
|
|
165
165
|
*/
|
|
166
166
|
// Regular Expressions for easy conversion of underscore tests:
|
|
167
167
|
// S: assert.deepEqual\(_.chunk\((.*)\), (.*), '
|
|
168
|
-
// R: Expect(testFable.
|
|
169
|
-
Expect(testFable.
|
|
168
|
+
// R: Expect(testFable.services.Utility.chunk($1)).to.deep.equal($2); // $3
|
|
169
|
+
Expect(testFable.services.Utility.chunk([], 2)).to.deep.equal([]); // chunk for empty array returns an empty array');
|
|
170
170
|
|
|
171
|
-
Expect(testFable.
|
|
172
|
-
Expect(testFable.
|
|
173
|
-
Expect(testFable.
|
|
171
|
+
Expect(testFable.services.Utility.chunk([1, 2, 3], 0)).to.deep.equal([]); // chunk into parts of 0 elements returns empty array');
|
|
172
|
+
Expect(testFable.services.Utility.chunk([1, 2, 3], -1)).to.deep.equal([]); // chunk into parts of negative amount of elements returns an empty array');
|
|
173
|
+
Expect(testFable.services.Utility.chunk([1, 2, 3])).to.deep.equal([]); // defaults to empty array (chunk size 0)');
|
|
174
174
|
|
|
175
|
-
Expect(testFable.
|
|
175
|
+
Expect(testFable.services.Utility.chunk([1, 2, 3], 1)).to.deep.equal([[1], [2], [3]]); // chunk into parts of 1 elements returns original array');
|
|
176
176
|
|
|
177
|
-
Expect(testFable.
|
|
178
|
-
Expect(testFable.
|
|
177
|
+
Expect(testFable.services.Utility.chunk([1, 2, 3], 3)).to.deep.equal([[1, 2, 3]]); // chunk into parts of current array length elements returns the original array');
|
|
178
|
+
Expect(testFable.services.Utility.chunk([1, 2, 3], 5)).to.deep.equal([[1, 2, 3]]); // chunk into parts of more then current array length elements returns the original array');
|
|
179
179
|
|
|
180
|
-
Expect(testFable.
|
|
181
|
-
Expect(testFable.
|
|
180
|
+
Expect(testFable.services.Utility.chunk([10, 20, 30, 40, 50, 60, 70], 2)).to.deep.equal([[10, 20], [30, 40], [50, 60], [70]]); // chunk into parts of less then current array length elements');
|
|
181
|
+
Expect(testFable.services.Utility.chunk([10, 20, 30, 40, 50, 60, 70], 3)).to.deep.equal([[10, 20, 30], [40, 50, 60], [70]]); // chunk into parts of less then current array length elements');
|
|
182
182
|
}
|
|
183
183
|
);
|
|
184
184
|
test
|
|
@@ -187,10 +187,12 @@ suite
|
|
|
187
187
|
function(fDone)
|
|
188
188
|
{
|
|
189
189
|
testFable = new libFable();
|
|
190
|
-
Expect(testFable.
|
|
191
|
-
Expect(testFable.
|
|
192
|
-
Expect(testFable.
|
|
193
|
-
Expect(testFable.
|
|
190
|
+
Expect(testFable.services.Utility.isoStringToDate('1986-06-11T09:34:46.012Z').getTime()).to.equal(518866486012);
|
|
191
|
+
Expect(testFable.services.Utility.isoStringToDate('2022-11-04T11:34:46.000Z').getTime()).to.equal(1667561686000);
|
|
192
|
+
Expect(testFable.services.Utility.isoStringToDate('2022-11-04T11:34:45.000Z').getTime()).to.equal(1667561685000);
|
|
193
|
+
Expect(testFable.services.Utility.isoStringToDate('1986-06-11T09:34:46.012Z').getTime()).to.equal(518866486012);
|
|
194
|
+
Expect(testFable.services.Utility.isoStringToDate('1986-06-11T09:34:46.012Z+0200').getTime()).to.equal(519586486012);
|
|
195
|
+
Expect(testFable.services.Utility.isoStringToDate('1986-06-11T09:34:46.012Z+0200').getTime()).to.equal(519586486012);
|
|
194
196
|
fDone();
|
|
195
197
|
}
|
|
196
198
|
)
|
|
@@ -203,7 +205,7 @@ suite
|
|
|
203
205
|
|
|
204
206
|
let tmpState = {};
|
|
205
207
|
|
|
206
|
-
testFable.
|
|
208
|
+
testFable.services.Utility.waterfall([
|
|
207
209
|
(fStageComplete)=>
|
|
208
210
|
{
|
|
209
211
|
tmpState.Name = 'The Pixies';
|
|
@@ -233,7 +235,7 @@ suite
|
|
|
233
235
|
|
|
234
236
|
let tmpData = ['a','b','c','d','e'];
|
|
235
237
|
|
|
236
|
-
testFable.
|
|
238
|
+
testFable.services.Utility.eachLimit(tmpData, 2,
|
|
237
239
|
(pItem, fCallback)=>
|
|
238
240
|
{
|
|
239
241
|
tmpState[pItem] = pItem;
|