Skip to content

Commit cf49854

Browse files
authored
Merge pull request #1734 from Meteor-Community-Packages/feature-warn-no-theme
Feature: warn on no theme
2 parents d1d2899 + bdf7560 commit cf49854

File tree

3 files changed

+27
-14
lines changed

3 files changed

+27
-14
lines changed

README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ AutoForm 7.0 is now available and decouples from the default themes. **You will
1717
Be sure to check out the [change log](./CHANGELOG.md#700) for full details, first.
1818
Note that if you use add-on packages that haven't been updated yet, you will not yet be able to update to version 6.
1919

20-
**Add-on Package Authors**: Please test your package against AutoForm 7.0, and then release a major version update in which you change your `api.use` to `api.use('aldeed:autoform@7.0.0');`.
20+
**Add-on Package Authors**: Please test your package against AutoForm 7.0, and then release a major version update in which you change your `api.use` to `api.use('aldeed:autoform@7.0.0');`.
2121
We do NOT recommend using something like `api.use('aldeed:autoform@6.0.0 || 7.0.0');` to try to support multiple major versions of AutoForm because there is currently a known Meteor issue where trying to support too many dependency paths leads to running out of memory when trying to resolve dependencies.
2222

2323
## Table of Contents
@@ -138,6 +138,7 @@ The following themes are available and tested to work with v7:
138138
- [autoform-plain](https://github.com/Meteor-Community-Packages/meteor-autoform-themes/tree/main/plain)
139139
- [autoform-bootstrap3](https://github.com/Meteor-Community-Packages/meteor-autoform-themes/tree/main/bootstrap3)
140140
- [autoform-bootstrap4](https://github.com/Meteor-Community-Packages/meteor-autoform-themes/tree/main/bootstrap4)
141+
- [autoform-bootstrap5](https://github.com/Meteor-Community-Packages/meteor-autoform-themes/tree/main/bootstrap5)
141142

142143
Please also consider, that `twbs:bootstrap` is depending on an outdated (and potential insecure!) Bootstrap version.
143144
Better: Use the latest Bootstrap 3.x or 4.x from NPM in favour.
@@ -160,7 +161,7 @@ You can easily circumvent this issue by editing the package entry in `.meteor/pa
160161
from `aldeed:autoform` to `aldeed:autoform@7.0.0!` (note the exclamation mark).
161162

162163
This is because many extensions will not have the `7.0.0` reference in their
163-
`package.js` file, yet. However, this major version is intended to not break
164+
`package.js` file, yet. However, this major version is intended to not break
164165
compatibility with extensions, that worked with `6.x`. If you encounter any
165166
runtime issues with extensions, please open an issue.
166167

@@ -183,7 +184,7 @@ That's it. The Templates are now available.
183184
### Import using dynamic imports
184185

185186
This package supports `dynamic-import`, which helps to reduce initial bundle
186-
size of the package from ~110 KB to ~60 KB (estimated via `bundle-visualizer`).
187+
size of the package from ~110 KB to ~60 KB (estimated via `bundle-visualizer`).
187188

188189
The following example shows how to import the packages dynamically:
189190

@@ -199,7 +200,7 @@ AutoForm.load()
199200
})
200201
```
201202
202-
You can even combine this with one of the themes (if they support dynamic imports)
203+
You can even combine this with one of the themes (if they support dynamic imports)
203204
like in the following example:
204205
205206
```javascript
@@ -237,14 +238,14 @@ initAutoForm()
237238
.catch(e => {
238239
// ... on error code
239240
})
240-
241+
241242
// ... other Template code
242-
243+
243244
Template.myCoolForm.helpers({
244245
loadComplete() {
245246
return autoFormLoaded.get()
246247
}
247-
})
248+
})
248249
```
249250
250251
### Community Add-On Packages
@@ -1801,6 +1802,8 @@ on the site, too. If the code is publicly available, link to that, too.
18011802
18021803
## Troubleshooting
18031804
1805+
* A warning is raised, containing `AutoForm: no theme found, please consult the README.`.
1806+
In such case you may want to [install a theme](#installation).
18041807
* While developing, be sure to call `AutoForm.debug()` in your client code to enable extra logging.
18051808
* If nothing happens when you click the submit button for your form and there are
18061809
no errors, make sure the button's type is `submit`.
@@ -1814,8 +1817,8 @@ about it in the [contributing guide](CONTRIBUTING.md) and also consider the
18141817
18151818
## Testing
18161819
1817-
In order to improve development we have replaced TinyTest with
1818-
`meteortesting:mocha` in combination with `chai` and `puppeteer`.
1820+
In order to improve development we have replaced TinyTest with
1821+
`meteortesting:mocha` in combination with `chai` and `puppeteer`.
18191822
18201823
This makes local tests much easier and also allows us to run tests in the CI.
18211824
We have added a minimal test project in this repo, that serves as our proxy
@@ -1839,7 +1842,7 @@ The following test commands are available:
18391842
- `test` - runs the tests once; CLI-only
18401843
- `test:watch` - runs the tests in watch mode; CLI-only
18411844
1842-
**Publishing note**
1845+
**Publishing note**
18431846
18441847
If you publish the package to atmosphere, make sure you
18451848
remove the test project or move it outside of the package root.
@@ -1881,7 +1884,7 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
18811884

18821885
## Credits
18831886

1884-
Many thanks to [Eric Dobbertin (aldeed)](https://github.com/aldeed) for creating
1887+
Many thanks to [Eric Dobbertin (aldeed)](https://github.com/aldeed) for creating
18851888
this package and many years of improvement and for the trust in Meteor Community Packages.
18861889

18871890
Also many thanks to all the [contributors](https://github.com/Meteor-Community-Packages/meteor-autoform/graphs/contributors).

autoform-api.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ AutoForm.getTemplateName = function autoFormGetTemplateName (
309309
}
310310

311311
// Found nothing. Return undefined
312+
console.warn('AutoForm: no theme found, please consult the README.')
312313
}
313314

314315
/**

tests/autoform-api.tests.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,27 @@ describe('api', function () {
170170
.to.equal(template)
171171
delete Template[template]
172172
})
173-
it("shows a warnring, if the attributes provided a templateName but that template didn't exist", function () {
174-
let warned = false
173+
it("shows a warnring, if the attributes provided a templateName but that template didn't exist", function (done) {
174+
const warned = false
175175
AutoForm._debug = true
176176
stub(console, 'warn', message => {
177177
expect(message).to.equal(`${templateType}: "${templateName}" is not a valid template name. Falling back to a different template.`)
178-
warned = true
178+
done()
179179
})
180180

181181
AutoForm.getTemplateName(templateType, templateName)
182182
expect(warned).to.equal(true)
183183
AutoForm._debug = false
184184
})
185+
it('shows a warnring, if no theme exists', function (done) {
186+
AutoForm._debug = false
187+
stub(console, 'warn', message => {
188+
expect(message).to.equal('AutoForm: no theme found, please consult the README.')
189+
done()
190+
})
191+
192+
AutoForm.getTemplateName(templateType)
193+
})
185194
it('Fallback #1: autoform.<componentType>.template from the schema', function () {
186195
let exec = false
187196
const schema = {

0 commit comments

Comments
 (0)