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 - [ ] folders
- [ ] string controller
- [ ] boolean controller
- [ ] function controller - [ ] function controller
- [ ] color controller - [ ] color controller
- [x] string controller
- [x] boolean controller

View File

@ -13,14 +13,10 @@
"ignore": [ "ignore": [
"**/.*", "**/.*",
"node_modules", "node_modules",
"components", "tests",
"test", "docs"
"tests"
], ],
"dependencies": { "dependencies": {
"polymer": "Polymer/polymer#~0.3.5" "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> </head>
<body> <body>
<script src="../underscore/underscore.js"></script>
<script> <script>
Gui.ready( init ); Gui.ready( init );

View File

@ -138,3 +138,4 @@
})( this ); })( this );

View File

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

View File

@ -5,11 +5,8 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>dat-gui kitchen sink</title> <title>dat-gui kitchen sink</title>
<script> <script src="../../platform/platform.js"></script>
var src = '../gui.html'; <link rel="import" href="../build/gui.html">
if ( location.search == '?built' ) src = '../build/gui.html';
document.write( '<link rel="import" href="'+src+'">' );
</script>
<style type="text/css"> <style type="text/css">
body { body {
@ -34,9 +31,11 @@
}; };
// How do we kill polymer-ready ... // 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; 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, '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.' ); gui.anon( 0, 'start', -2, 2, 1 ).comment( 'The frame of the gif where the song should start.' );
}); } );
</script> </script>

View File

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

View File

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

View File

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