@teleporthq/teleport-project-generator-html 0.43.71 → 0.43.73
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.
|
@@ -120,6 +120,73 @@ describe('Conditions in a static HTML page', () => {
|
|
|
120
120
|
expect(openingTag(page, 'regular-price')).not.toContain('data-tq-if')
|
|
121
121
|
})
|
|
122
122
|
|
|
123
|
+
it('a condition on a list or an object is answered on what it starts with', async () => {
|
|
124
|
+
const page = await homePage(
|
|
125
|
+
[
|
|
126
|
+
when(state('lines'), [{ operation: 'isEmpty' }], 'cart-empty'),
|
|
127
|
+
when(state('lines'), [{ operation: 'isNotEmpty' }], 'cart-lines'),
|
|
128
|
+
when(state('picked'), [{ operation: 'isNotEmpty' }], 'some-picked'),
|
|
129
|
+
when(state('picked'), [{ operation: 'contains', operand: 'b' }], 'picked-b'),
|
|
130
|
+
when(state('picked'), [{ operation: 'notContains', operand: 'z' }], 'not-picked-z'),
|
|
131
|
+
when(state('picked'), [{ operation: 'contains', operand: 'z' }], 'picked-z'),
|
|
132
|
+
when(state('picked'), [{ operation: 'lengthGreaterThan', operand: 1 }], 'several'),
|
|
133
|
+
when(state('picked'), [{ operation: 'lengthEquals', operand: 3 }], 'three'),
|
|
134
|
+
when(
|
|
135
|
+
state('rows'),
|
|
136
|
+
[{ operation: 'contains', operand: 7, containsField: 'id' }],
|
|
137
|
+
'row-seven'
|
|
138
|
+
),
|
|
139
|
+
when(state('filters'), [{ operation: 'hasKey', operand: 'size' }], 'by-size'),
|
|
140
|
+
when(state('filters'), [{ operation: 'notHasKey', operand: 'size' }], 'any-size'),
|
|
141
|
+
when(state('heading'), [{ operation: 'isNotEmpty' }], 'with-heading'),
|
|
142
|
+
],
|
|
143
|
+
{
|
|
144
|
+
lines: { type: 'array', defaultValue: [] },
|
|
145
|
+
picked: { type: 'array', defaultValue: ['a', 'b'] },
|
|
146
|
+
rows: { type: 'array', defaultValue: [{ id: 7 }, { id: 9 }] },
|
|
147
|
+
filters: { type: 'object', defaultValue: { size: 'm' } },
|
|
148
|
+
heading: { type: 'string', defaultValue: 'Hello' },
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
const shown = [
|
|
153
|
+
'cart-empty',
|
|
154
|
+
'some-picked',
|
|
155
|
+
'picked-b',
|
|
156
|
+
'not-picked-z',
|
|
157
|
+
'several',
|
|
158
|
+
'row-seven',
|
|
159
|
+
'by-size',
|
|
160
|
+
'with-heading',
|
|
161
|
+
]
|
|
162
|
+
const absent = ['cart-lines', 'picked-z', 'three', 'any-size']
|
|
163
|
+
expect(shown.filter((id) => !shows(page, id))).toEqual([])
|
|
164
|
+
expect(absent.filter((id) => inPage(page, id))).toEqual([])
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
it('a condition it cannot answer renders nothing, and the page is still exported', async () => {
|
|
168
|
+
const page = await homePage(
|
|
169
|
+
[
|
|
170
|
+
// a list is not a value `===` can be written against
|
|
171
|
+
when(state('lines'), [{ operation: '===', operand: 'x' }], 'list-equals'),
|
|
172
|
+
// the other side is read while the page runs
|
|
173
|
+
when(state('picked'), [{ operation: 'contains', operand: state('choice') }], 'by-choice'),
|
|
174
|
+
when(state('filters'), [{ operation: '!' }], 'no-filters'),
|
|
175
|
+
when(state('open'), [{ operation: '===', operand: true }], 'panel'),
|
|
176
|
+
],
|
|
177
|
+
{
|
|
178
|
+
lines: { type: 'array', defaultValue: [] },
|
|
179
|
+
picked: { type: 'array', defaultValue: ['a'] },
|
|
180
|
+
filters: { type: 'object', defaultValue: {} },
|
|
181
|
+
choice: { type: 'string', defaultValue: 'a' },
|
|
182
|
+
open: { type: 'boolean', defaultValue: true },
|
|
183
|
+
}
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
expect(['list-equals', 'by-choice', 'no-filters'].filter((id) => inPage(page, id))).toEqual([])
|
|
187
|
+
expect(shows(page, 'panel')).toBe(true)
|
|
188
|
+
})
|
|
189
|
+
|
|
123
190
|
it('a value holding a quote still compares', async () => {
|
|
124
191
|
const quote = 'She said "yes"'
|
|
125
192
|
const page = await homePage(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teleporthq/teleport-project-generator-html",
|
|
3
|
-
"version": "0.43.
|
|
3
|
+
"version": "0.43.73",
|
|
4
4
|
"description": "Project generator for generate plain html files",
|
|
5
5
|
"author": "teleportHQ",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
"build": "tsc -p tsconfig.json && tsc -p tsconfig.json --module commonjs --outDir dist/cjs"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@teleporthq/teleport-component-generator": "^0.43.
|
|
28
|
-
"@teleporthq/teleport-component-generator-html": "^0.43.
|
|
27
|
+
"@teleporthq/teleport-component-generator": "^0.43.73",
|
|
28
|
+
"@teleporthq/teleport-component-generator-html": "^0.43.73",
|
|
29
29
|
"@teleporthq/teleport-plugin-css": "^0.43.71",
|
|
30
30
|
"@teleporthq/teleport-postprocessor-prettier-html": "^0.43.71",
|
|
31
|
-
"@teleporthq/teleport-project-generator": "^0.43.
|
|
31
|
+
"@teleporthq/teleport-project-generator": "^0.43.73",
|
|
32
32
|
"@teleporthq/teleport-shared": "^0.43.71",
|
|
33
33
|
"cheerio": "^1.0.0-rc.12",
|
|
34
34
|
"path-browserify": "^1.0.1"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "fc4c5c2f1bf86e72f258601ad5f6384e91117044"
|
|
37
37
|
}
|