-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
67 lines (67 loc) · 2.84 KB
/
app.js
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
"use strict";
const zenCore_1 = require("./zenCore");
const zenPolymer1_1 = require("./zenPolymer1");
const test1 = zenCore_1.zen `.myClass2>ul#myUL.myClass1@myAttrib1:val1@myAttrib2:42@myAttrib3>li${'Hello, '}+li${'World.'}`;
//console.log(test1);
const html1 = test1.join('');
console.assert(html1 === `<div class="myClass2"><ul id="myUL" my-attrib1="val1" my-attrib2="42" my-attrib3 class="myClass1"><li>Hello, </li><li>World.</li></ul></div>`, 'test1 failed');
const test2 = zenCore_1.zen `@a:456${'123'}`;
const html2 = test2.join('');
console.assert(html2 === `<div a="456">123</div>`, 'test2 failed');
const cnnURL = "http://www.cnn.com";
const cnnText = 'This is CNN';
const test3 = zenCore_1.zen `a${{ href: cnnURL, innerHTML: cnnText }}`;
//console.log(test3);
const html3 = test3.join('');
//console.log(html3);
console.assert(html3 === `<a href="${cnnURL}">${cnnText}</a>`, 'test 3 failed');
const range = [1, 2, 3, 4, 5];
const test4 = zenCore_1.zen `ul ${{ '➰': range, '🎬': n => zenCore_1.zen `li${'item ' + n}` }}`;
//console.log(test4);
const html4 = test4.join('');
//console.log(html4);
console.assert(html4 === '<ul><li>item 1</li><li>item 2</li><li>item 3</li><li>item 4</li><li>item 5</li></ul>', 'test 4 failed');
const PhotoElement = {
imageSrc: {
type: String,
setter: (newVal, oldVal, _this) => {
_this.importHref('blah');
},
polymer1Setter: (newVal, oldVal, _this) => {
},
postVendorSetter: (newVal, oldVal, _this) => {
}
},
caption: {
type: String
},
imageAndCaption: {
type: String,
readOnly: true,
getter: (imageSrc, caption, _this) => {
return caption + '[' + imageSrc + ']';
}
}
};
const test9 = zenPolymer1_1.toPolymerElement(PhotoElement);
console.log(test9);
const test5 = zenCore_1.zen `span${o => `Hello, ${o.imageSrc}, good day!`}`;
zenPolymer1_1.zenToPolymer1(test5, PhotoElement);
//console.log(test5);
const html5 = test5.join('');
console.assert(html5 === '<span>Hello, [[imageSrc]], good day!</span>', 'test 5 failed');
const PhotoAlbum = {
photos: [PhotoElement],
};
const test6 = zenCore_1.zen `ul ${{ '➰': p => p.photos, '🎬': photo => zenCore_1.zen `li${'photo ' + photo.imageSrc}` }}`;
const test6a = test6.map(x => x.toString());
//console.log(test6a);
zenPolymer1_1.zenToPolymer1(test6, PhotoAlbum);
const flattenedTest6 = zenPolymer1_1.flattenArray(test6);
const html6 = flattenedTest6.join('');
//console.log(html6);
console.assert(html6 === '<ul><template is="dom-repeat" items="{{photos}}"><li>photo [[item.imageSrc]]</li></template></ul>', 'test6 failed');
global['PhotoElement'] = PhotoElement;
const test7 = zenCore_1.zen `ul><PhotoElement>${{ caption: 'iah' }}`;
//console.log(test7);
//# sourceMappingURL=app.js.map