https://github.com/dereke/mount-app
https://github.com/dereke/mount-app
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dereke/mount-app
- Owner: dereke
- Created: 2015-11-23T15:32:08.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-23T16:34:21.000Z (over 9 years ago)
- Last Synced: 2025-02-18T23:47:51.183Z (4 months ago)
- Language: JavaScript
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Test Element
Use this library to create a test element that you can use in karma tests or similar```
var mountApp = require('mount-app');
describe('awesome feature', function(){
it('is a silver bullet', function(){
mountApp(function(testEl, data){
var el = document.createElement('h1');
el.innerText = data.message;testEl.appendChild(el);
}, {message: 'Hello World'}, {url: '/my-app/home'})
});
});
```## mountApp
* createApp - a function that creates an application and attaches itself to the test element
- testEl - the element to attach to
- data - the data object passed to mountApp
* data - any data to initialise the app with
* options - mounting options
- url - the relative url to set the page to before mounting