pict 1.0.7
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/.babelrc +3 -0
- package/.browserslistrc +1 -0
- package/.browserslistrc_compatible +1 -0
- package/.browserslistrc_default +1 -0
- package/.config/code-server/config.yaml +4 -0
- package/.config/configstore/update-notifier-npm-check-updates.json +4 -0
- package/.config/configstore/update-notifier-npm.json +4 -0
- package/.config/installation/UI-Requirements.md +32 -0
- package/.config/installation/install_luxury_code.js +105 -0
- package/.config/installation/install_luxury_default_configuration.json +45 -0
- package/.config/installation/install_luxury_interaction.json +3 -0
- package/.config/installation/precedent.1.0.5.js +339 -0
- package/.config/luxury-extras/.vscode/launch.json +46 -0
- package/.config/luxury-extras/Dockerfile_LUXURYCode +39 -0
- package/.config/luxury-extras/MySQL/Dockerfile_LUXURYCODE_MySQL +65 -0
- package/.config/luxury-extras/MySQL/MySQL-Laden-Entry.sh +17 -0
- package/.config/luxury-extras/MySQL/MySQL-Security.sql +5 -0
- package/.travis.yml +14 -0
- package/.vscode/launch.json +46 -0
- package/Dockerfile_LUXURYCode +39 -0
- package/LICENSE +22 -0
- package/README.md +79 -0
- package/bower.json +25 -0
- package/debug/Harness.js +35 -0
- package/debug/examples/informary/Harness.js +19 -0
- package/debug/examples/informary/README.md +43 -0
- package/debug/examples/informary/bootstrap/css/bootstrap.css +10259 -0
- package/debug/examples/informary/bootstrap/js/bootstrap.min.js +7 -0
- package/debug/examples/informary/index.html +379 -0
- package/debug/examples/simpleApp/index.html +66 -0
- package/dist/pict.compatible.js +5705 -0
- package/dist/pict.compatible.min.js +246 -0
- package/dist/pict.compatible.min.js.map +1 -0
- package/dist/pict.js +5705 -0
- package/dist/pict.min.js +238 -0
- package/dist/pict.min.js.map +1 -0
- package/gulpfile-config.json +11 -0
- package/gulpfile-config_compatible.json +11 -0
- package/gulpfile-config_default.json +11 -0
- package/gulpfile.js +164 -0
- package/package.json +66 -0
- package/site_prototype/index.html +23 -0
- package/source/Pict-Browser-Shim.js +15 -0
- package/source/Pict-Fable-Service-Elucidator.js +17 -0
- package/source/Pict-Fable-Service-Informary.js +17 -0
- package/source/Pict-Fable-Service-Manyfest.js +24 -0
- package/source/Pict-Template-Provider.js +105 -0
- package/source/Pict.js +141 -0
- package/test/Pict_tests.js +139 -0
- package/test/data/SampleRecord-Quantity.json +13 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for Pict
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
*
|
|
6
|
+
* @author Steven Velozo <steven@velozo.com>
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const Chai = require("chai");
|
|
10
|
+
const Expect = Chai.expect;
|
|
11
|
+
|
|
12
|
+
const libPict = require('../source/Pict.js');
|
|
13
|
+
|
|
14
|
+
const _MockSettings = (
|
|
15
|
+
{
|
|
16
|
+
Product: 'MockPict',
|
|
17
|
+
ProductVersion: '0.0.0'
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const _QuantityTemplate = `
|
|
21
|
+
<td>{~Data:Record.worktype_String~}</td>
|
|
22
|
+
<td align="center">{~Data:Record.itemnumber~}</td>
|
|
23
|
+
<td width="45%">{~Data:Record.description~}</td>
|
|
24
|
+
<td align="left">{~Data:Record.units~}</td>
|
|
25
|
+
<td align="right">{~Dollars:Record.costperunit~}</td>
|
|
26
|
+
<td align="right">{~Digits:Record.quantity~}</td>
|
|
27
|
+
<td align="right">{~Dollars:Record.amount~}</td>
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
const _QuantityRecord = require('./data/SampleRecord-Quantity.json');
|
|
31
|
+
|
|
32
|
+
suite
|
|
33
|
+
(
|
|
34
|
+
'Pict',
|
|
35
|
+
function()
|
|
36
|
+
{
|
|
37
|
+
setup
|
|
38
|
+
(
|
|
39
|
+
function()
|
|
40
|
+
{
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
suite
|
|
45
|
+
(
|
|
46
|
+
'Object Sanity',
|
|
47
|
+
function()
|
|
48
|
+
{
|
|
49
|
+
test
|
|
50
|
+
(
|
|
51
|
+
'The class should initialize itself into a happy little object.',
|
|
52
|
+
function(fDone)
|
|
53
|
+
{
|
|
54
|
+
var testPict = new libPict(_MockSettings);
|
|
55
|
+
Expect(testPict).to.be.an('object', 'Pict should initialize as an object directly from the require statement.');
|
|
56
|
+
fDone();
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
test
|
|
60
|
+
(
|
|
61
|
+
'How about a little template for the road...',
|
|
62
|
+
function(fDone)
|
|
63
|
+
{
|
|
64
|
+
var testPict = new libPict(_MockSettings);
|
|
65
|
+
testPict.initializeTemplateMethods();
|
|
66
|
+
testPict.appData.TestValue = 'Test';
|
|
67
|
+
|
|
68
|
+
let tmpTemplateOutput = testPict.parseTemplate('This is a test of the {~Data:AppData.TestValue~} template system.');
|
|
69
|
+
Expect(tmpTemplateOutput).to.equal('This is a test of the Test template system.', 'The template system should parse a simple template.');
|
|
70
|
+
fDone();
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
test
|
|
74
|
+
(
|
|
75
|
+
'How about a different template test for the road...',
|
|
76
|
+
function(fDone)
|
|
77
|
+
{
|
|
78
|
+
var testPict = new libPict(_MockSettings);
|
|
79
|
+
testPict.initializeTemplateMethods();
|
|
80
|
+
testPict.appData.TestValue = 'Test';
|
|
81
|
+
|
|
82
|
+
let tmpTemplateOutput = testPict.parseTemplate('This is a test of the {~Data:AppData.TestValue~} template system: Dollars {~Dollars:Record.Values[0]~} or Digits {~Digits:Record.Values[0]~}.', {Values: [35.5, 42]});
|
|
83
|
+
Expect(tmpTemplateOutput).to.equal('This is a test of the Test template system: Dollars $35.50 or Digits 35.50.', 'The template system should parse a simple template.');
|
|
84
|
+
fDone();
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
test
|
|
88
|
+
(
|
|
89
|
+
'Use the template manager a bit...',
|
|
90
|
+
function(fDone)
|
|
91
|
+
{
|
|
92
|
+
var testPict = new libPict(_MockSettings);
|
|
93
|
+
testPict.initializeTemplateMethods();
|
|
94
|
+
|
|
95
|
+
testPict.templateProvider.addTemplate('Quantity', _QuantityTemplate);
|
|
96
|
+
|
|
97
|
+
let tmpTemplateOutput = testPict.parseTemplateByHash('Quantity', _QuantityRecord);
|
|
98
|
+
Expect(tmpTemplateOutput).to.equal(`
|
|
99
|
+
<td>0099 Horizontal Carrier Conduit Directional Drill</td>
|
|
100
|
+
<td align="center">OU-001-19819</td>
|
|
101
|
+
<td width="45%">Directional Bore Conduit</td>
|
|
102
|
+
<td align="left">LNFT</td>
|
|
103
|
+
<td align="right">$852.00</td>
|
|
104
|
+
<td align="right">867.53</td>
|
|
105
|
+
<td align="right">--</td>
|
|
106
|
+
`, 'The template system should parse a simple template from a hash.');
|
|
107
|
+
|
|
108
|
+
Expect(testPict.parseTemplateByHash('ThisTemplateDoesNotExist', _QuantityRecord)).to.equal('', 'The template system should return an empty string if the template does not exist.');
|
|
109
|
+
|
|
110
|
+
return fDone();
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
test
|
|
114
|
+
(
|
|
115
|
+
'Try some defaults for the template manager...',
|
|
116
|
+
function(fDone)
|
|
117
|
+
{
|
|
118
|
+
var testPict = new libPict(_MockSettings);
|
|
119
|
+
testPict.initializeTemplateMethods();
|
|
120
|
+
|
|
121
|
+
testPict.templateProvider.addDefaultTemplate('-ListTitle', '<h1>List of {~Data:AppData.EntityName~}s</h1>');
|
|
122
|
+
testPict.templateProvider.addDefaultTemplate('-ListRow', '<p>{~Data:Record.Name~}</p>');
|
|
123
|
+
|
|
124
|
+
testPict.appData.EntityName = 'Band';
|
|
125
|
+
|
|
126
|
+
Expect(testPict.templateProvider.templates.hasOwnProperty('Quantity-ListTitle')).to.equal(false, 'No template should exist before it is either set explicitly or accessed from a default.');
|
|
127
|
+
Expect(testPict.parseTemplateByHash('Quantity-ListTitle', _QuantityRecord)).to.equal('<h1>List of Bands</h1>', 'The template system should parse a simple default template from a hash.');
|
|
128
|
+
|
|
129
|
+
// The second path should have the template set!
|
|
130
|
+
Expect(testPict.templateProvider.templates.hasOwnProperty('Quantity-ListTitle')).to.equal(true, 'The template system should have a default template set for Quantity-ListTitle after accessing it once.');
|
|
131
|
+
Expect(testPict.parseTemplateByHash('Quantity-ListTitle', _QuantityRecord)).to.equal('<h1>List of Bands</h1>', 'The template system should parse a simple default template from a hash.');
|
|
132
|
+
|
|
133
|
+
return fDone();
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"addressprefix": "Content.UUID001",
|
|
3
|
+
"idrecord": 1,
|
|
4
|
+
"description": "Directional Bore Conduit",
|
|
5
|
+
"quantity": 867.5309,
|
|
6
|
+
"units": "LNFT",
|
|
7
|
+
"costperunit": "852.0",
|
|
8
|
+
"worktype": 310381,
|
|
9
|
+
"worktype_String": "0099 Horizontal Carrier Conduit Directional Drill",
|
|
10
|
+
"worktype_StringAbbreviated": "0099",
|
|
11
|
+
"worktype_PayItemSet": "OU-001-19819",
|
|
12
|
+
"itemnumber": "OU-001-19819"
|
|
13
|
+
}
|