cross browser woes

This commit is contained in:
George Michael Brower 2014-09-02 12:00:08 -04:00
parent 407abe299c
commit 9ab83a6fe3
12 changed files with 90 additions and 100 deletions

4
TODO
View File

@ -3,8 +3,8 @@
- [ ] folders
- [ ] string controller
- [ ] boolean controller
- [ ] function controller
- [ ] color controller
- [x] string controller
- [x] boolean controller

View File

@ -13,14 +13,10 @@
"ignore": [
"**/.*",
"node_modules",
"components",
"test",
"tests"
"tests",
"docs"
],
"dependencies": {
"polymer": "Polymer/polymer#~0.3.5"
},
"devDependencies": {
"underscore": "~1.6.0"
}
}

File diff suppressed because one or more lines are too long

View File

@ -13,8 +13,6 @@
</head>
<body>
<script src="../underscore/underscore.js"></script>
<script>
Gui.ready( init );

View File

@ -137,4 +137,5 @@
scope.Gui = Gui;
})( this );
})( this );

View File

@ -11,5 +11,5 @@
}
#input {
vertical-align: middle;
// margin-top: 20px;
}

View File

@ -5,12 +5,9 @@
<meta charset="utf-8">
<title>dat-gui kitchen sink</title>
<script>
var src = '../gui.html';
if ( location.search == '?built' ) src = '../build/gui.html';
document.write( '<link rel="import" href="'+src+'">' );
</script>
<script src="../../platform/platform.js"></script>
<link rel="import" href="../build/gui.html">
<style type="text/css">
body {
background: #aaa;
@ -34,9 +31,11 @@
};
// How do we kill polymer-ready ...
Gui.ready( function() {
// Gui.ready( function() {
gui = new dat.GUI();
document.addEventListener( 'polymer-ready', function() {
gui = new Gui();
gui.docked = true;
@ -68,7 +67,7 @@
gui.anon( 0, 'loops', -2, 2, 1 ).comment( 'The number of times the gif loops in a cycle.' );
gui.anon( 0, 'start', -2, 2, 1 ).comment( 'The frame of the gif where the song should start.' );
});
} );
</script>

View File

@ -1,4 +1,4 @@
<script src="../platform/platform.js"></script>
<!-- <script src="../platform/platform.js"></script> -->
<!-- src -->
<script src="elements/Gui.js"></script>

View File

@ -5,24 +5,45 @@
*/
var gulp = require( 'gulp' ),
stylus = require( 'gulp-stylus' ),
plates = require( 'gulp-plates' ),
rename = require( 'gulp-rename' ),
vulcan = require( 'gulp-vulcanize' ),
nib = require( 'nib' ),
fs = require( 'fs' ),
$ = require( 'gulp-load-plugins' )( { 'pattern': '*' } );
marked = require( 'marked' ),
karma = require( 'karma' ).server;
var paths = {
main: 'gui.html',
css: 'elements/**/*.styl',
html: 'elements/**/*.html',
js: 'elements/**/*.js',
}
};
function stylus( src, dest ) {
gulp.src( src )
.pipe( $.stylus( { use: [ $.nib() ] } ) )
.pipe( stylus( { use: [ nib() ] } ) )
.pipe( gulp.dest( dest ) );
}
gulp.task( 'docs', function() {
stylus( 'docs/*.styl', 'docs' );
var content = {
readme: marked( fs.readFileSync( 'README.md', 'utf8' ) )
}
gulp.src( 'docs/template.html' )
.pipe( plates( content ) )
.pipe( rename( 'index.html' ) )
.pipe( gulp.dest( './' ) );
} );
gulp.task( 'css', function() {
stylus( paths.css, 'elements' );
@ -32,7 +53,7 @@ gulp.task( 'css', function() {
gulp.task( 'vulcanize', function() {
gulp.src( paths.main )
.pipe( $.vulcanize( {
.pipe( vulcan( {
dest: 'build',
inline: true
// strip: true
@ -40,22 +61,18 @@ gulp.task( 'vulcanize', function() {
} );
gulp.task( 'docs', function() {
stylus( 'docs/*.styl', 'docs' );
gulp.task( 'test', function( done ) {
var content = {
readme: $.marked( fs.readFileSync( 'README.md', 'utf8' ) )
}
gulp.src( 'docs/template.html' )
.pipe( $.plates( content ) )
.pipe( $.rename( 'index.html' ) )
.pipe( gulp.dest( './' ) );
} );
gulp.task( 'test', function() {
karma.start( {
// browsers: [ 'Chrome' ],
frameworks: [ 'jasmine' ],
files: [
'../platform/platform.js',
'build/gui.html',
'tests/*.js'
],
// singleRun: true
}, done );
} );
@ -63,10 +80,9 @@ gulp.task( 'build', [ 'css', 'vulcanize', 'test', 'docs' ] );
gulp.task( 'default', function() {
gulp.task( 'build' );
gulp.watch( [ paths.css ], [ 'css', 'vulcanize' ] );
gulp.watch( [ paths.js, paths.main, paths.html ], [ 'vulcanize', 'test' ] );
gulp.watch( [ paths.js, paths.main, paths.html ], [ 'vulcanize' ] );
// gulp.watch( [ 'build/gui.html', 'tests/*.js' ], [ 'test' ] );
gulp.watch( [ 'README.md', 'docs/*' ], [ 'docs' ] );
} );

View File

@ -3,14 +3,14 @@
"version": "0.0.0",
"devDependencies": {
"gulp": "^3.8.7",
"gulp-connect": "^2.0.6",
"gulp-load-plugins": "^0.5.3",
"gulp-plates": "0.0.5",
"gulp-qunit": "^0.3.3",
"gulp-rename": "^1.2.0",
"gulp-stylus": "^1.3.0",
"gulp-vulcanize": "^1.0.0",
"gulp-watch": "^0.6.9",
"karma": "^0.12.23",
"karma-chrome-launcher": "^0.1.4",
"karma-jasmine": "^0.1.5",
"marked": "^0.3.2",
"nib": "^1.0.3"
}

View File

@ -1,35 +0,0 @@
<!doctype html>
<html>
<head>
<title>dat-gui Test Runner (Mocha)</title>
<meta charset="utf-8">
<link rel="stylesheet" href="../../tools/test/mocha/mocha.css">
<link rel="import" href="../polymer.html">
</head>
<body>
<div id="mocha"></div>
<script>
mocha.setup({ui: 'tdd', slow: 1000, timeout: 10000, htmlbase: ''});
</script>
<!-- -->
<script src="js/marshall.js"></script>
<script src="js/oop.js"></script>
<script src="js/bindProperties.js"></script>
<script src="js/bindMDV.js"></script>
<script src="js/attrs.js"></script>
<script src="js/properties.js"></script>
<script src="js/register.js"></script>
<script src="js/prepare.js"></script>
<script src="js/events.js"></script>
<script src="js/styling.js"></script>
<script src="js/mdv-syntax.js"></script>
<script src="js/paths.js"></script>
<script src="js/utils.js"></script>
<!-- -->
<script>
document.addEventListener('polymer-ready', function() {
mocha.run();
});
</script>
</body>
</html>

29
tests/test.js Normal file
View File

@ -0,0 +1,29 @@
describe('Gui', function() {
it( 'exists', function() {
expect( Gui ).toBeDefined();
});
it( 'has a ready callback', function() {
var ready = {
ready: function() {}
};
spyOn( ready, 'ready' );
runs( function() {
Gui.ready( ready.ready );
} );
waits( 10 );
runs( function() {
expect( ready.ready ).toHaveBeenCalled();
} );
} );
});