can
Version:
MIT-licensed, client-side, JavaScript framework that makes building rich web applications easy.
41 lines (38 loc) • 1.3 kB
HTML
<html>
<head>
<meta http-equiv="x-ua-compatible" content="IE=Edge"/>
<script type="text/javascript" src="../../../bower_components/modernizr/modernizr.js"></script>
</head>
<body>
<script>
window.isReady = window.parent.isReady || function(el) {
console.log(el.length);
console.log(el.html());
};
window.hasError = window.parent.hasError || function(error) {
console.log("error in autoload", error)
};
window.removeMyself = window.parent.removeMyself;
</script>
<script type='text/stache' id='basics' foo='bar' can-autorender>
<can-import from="can/view/autorender/tests/steal-basics"/>
<my-component></my-component>
<p id='foo'>{{foo}}</p>
<p id='baz'>{{baz}}</p>
</script>
<script src='../../../node_modules/steal/steal.js' main='can/view/autorender/'></script>
<script>
steal('can', 'can/view/autorender',function(can, ready){
ready(function() {
if (window.parent.QUnit) {
$('#basics').viewModel().attr('baz','bazzz');
window.parent.equal($('#foo').html(), 'bar', 'template tag attributes are part of autorendered view model');
window.parent.equal($('#baz').html(), 'bazzz', 'autorendered view model is attached correctly');
}
isReady($("body my-component"), can.viewModel('my-component'));
}, hasError);
});
</script>
</body>
</html>