Permalink
Browse files

componentify

  • Loading branch information...
1 parent 2d0d639 commit b3f4ebc04a1989c0b0aabeefde55298051dc3176 @lightsofapollo committed May 8, 2014
Showing with 131 additions and 0 deletions.
  1. +13 −0 Makefile
  2. +1 −0 browser-test.opts
  3. +12 −0 browser_test.js
  4. +20 −0 component.json
  5. +6 −0 test/browser_test.js
  6. +18 −0 test/component.json
  7. +58 −0 test/entrypoint.html
  8. +1 −0 test/fixture.txt
  9. +2 −0 test/index.js
View
@@ -0,0 +1,13 @@
+node_modules: package.json
+ npm install
+
+build: components index.js
+ @./node_modules/.bin/component build --dev
+
+components: component.json
+ @./node_modules/.bin/component install --dev
+
+clean:
+ rm -fr build components template.js
+
+.PHONY: clean
View
@@ -0,0 +1 @@
+--entrypoint test/entrypoint.html
View
@@ -0,0 +1,12 @@
+suite('browser support', function() {
+ var superagent = require('superagent-promise');
+
+ test('get a fixture', function() {
+ return superagent.get('/test/fixture.txt').
+ end().
+ then(function(res) {
+ assert.equal(res.text, 'fixtureyay');
+ });
+ });
+
+});
View
@@ -0,0 +1,20 @@
+{
+ "name": "superagent-promise",
+ "repo": "lightsofapollo/superagent-promise",
+ "description": "",
+ "version": "0.0.1",
+ "keywords": [],
+ "dependencies": {
+ "visionmedia/superagent": "~0.18.0"
+ },
+ "development": {
+ "scripts": [
+ "browser_test.js"
+ ]
+ },
+ "license": "MIT",
+ "main": "index.js",
+ "scripts": [
+ "index.js"
+ ]
+}
@@ -0,0 +1,6 @@
+describe('do stuff', function() {
+
+ it('should work', function() {
+ });
+
+});
View
@@ -0,0 +1,18 @@
+{
+ "name": "test",
+ "description": "",
+ "version": "0.0.1",
+ "keywords": [],
+ "dependencies": {
+ "visionmedia/mocha": "^1.18.2",
+ "component/assert": "~0.3.0"
+ },
+ "development": {
+ },
+ "license": "MIT",
+ "main": "index.js",
+ "scripts": [
+ "index.js",
+ "*_test.js"
+ ]
+}
View
@@ -0,0 +1,58 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <title>body</title>
+ <link rel="stylesheet" href="/node_modules/mocha/mocha.css" title="" type="text/css" />
+</head>
+<body>
+<div id="mocha"></div>
+<script src="/browser_test/browser_test.js" type="text/javascript" charset="utf-8"></script>
+<script src="/node_modules/mocha/mocha.js" type="text/javascript" charset="utf-8"></script>
+<script src="/build/build.js" type="text/javascript" charset="utf-8"></script>
+
+<script type="text/javascript" charset="utf-8">
+/** ghetto mocha reporter */
+
+function Reporter(runner) {
+ runner.on('start', function(evt) {
+ browserTest.createSuite(this.total);
+ });
+
+ runner.on('test', function(evt) {
+ browserTest.createTest(evt.fullTitle());
+ });
+
+ runner.on('pass', function(evt) {
+ browserTest.passTest();
+ });
+
+ runner.on('fail', function(evt, err) {
+ browserTest.failTest(err);
+ });
+
+ runner.on('pending', function(evt) {
+ browserTest.createTest(evt.title)
+ browserTest.pendingTest();
+ });
+
+ runner.once('end', function() {
+ browserTest.finishSuite();
+ });
+}
+
+mocha.setup({
+ ui: 'tdd',
+ reporter: Reporter
+});
+
+</script>
+
+<script type="text/javascript" charset="utf-8">
+// component stores its paths by module name in dev mode this path should look like:
+// azure_table/file_test.js
+require('superagent-promise' + browserTest.fileName);
+mocha.run();
+</script>
+</body>
+</html>
View
@@ -0,0 +1 @@
+fixtureyay
View
@@ -0,0 +1,2 @@
+// include the tests
+require('./browser_test');

0 comments on commit b3f4ebc

Please sign in to comment.