--- /dev/null
+node_modules
+bower_components
+*.swa
+*.swp
+*.swo
--- /dev/null
+{
+ "name": "tech-radar",
+ "version": "0.0.0",
+ "homepage": "https://github.com/Trecenti/tech-radar",
+ "authors": [
+ "Bruno Trecenti <btrecent@thoughtworks.com>"
+ ],
+ "license": "MIT",
+ "private": true,
+ "dependencies": {
+ "d3": "~3.4.2"
+ }
+}
--- /dev/null
+var gulp = require('gulp')
+ , gutil = require('gulp-util')
+ , gkarma = require('gulp-karma')
+ , files;
+
+files = {
+ LIB: 'bower_components/d3/*.min.js',
+ NS: 'src/namespaces.js',
+ SOURCE: 'src/**/*.js',
+ SPEC: 'test/**/*-spec.js'
+};
+
+gulp.task('test', function (){
+ var karma;
+
+ karma = gkarma({
+ configFile: 'karma.conf.js',
+ action: 'run'
+ });
+
+ return gulp.src(
+ [files.LIB, files.NS, files.SOURCE, files.SPEC]
+ ).pipe(karma);
+});
--- /dev/null
+module.exports = function(config) {
+ config.set({
+ frameworks: ['jasmine'],
+ browsers: ['PhantomJS']
+ });
+};
--- /dev/null
+{
+ "name": "tech-radar",
+ "version": "0.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "author": "",
+ "license": "ISC",
+ "devDependencies": {
+ "gulp-util": "~2.2.14",
+ "gulp": "~3.5.2",
+ "karma-script-launcher": "~0.1.0",
+ "karma-chrome-launcher": "~0.1.2",
+ "karma-firefox-launcher": "~0.1.3",
+ "karma-html2js-preprocessor": "~0.1.0",
+ "karma-jasmine": "~0.1.5",
+ "karma-coffee-preprocessor": "~0.1.3",
+ "requirejs": "~2.1.11",
+ "karma-requirejs": "~0.2.1",
+ "karma-phantomjs-launcher": "~0.1.2",
+ "karma": "~0.10.9",
+ "gulp-karma": "0.0.2"
+ },
+ "dependencies": {
+ "gulp-util": "~2.2.14",
+ "gulp": "~3.5.2",
+ "express": "~3.4.8"
+ }
+}
--- /dev/null
+tr.models.Blip = function (name, cycle, isNew) {
+ var self = {};
+
+ self.name = function () {
+ return name;
+ };
+
+ self.isNew = function () {
+ return isNew;
+ };
+
+ self.cycle = function () {
+ return cycle;
+ };
+
+ return self;
+};
--- /dev/null
+tr.models.Cycle = function (name) {
+ var self = {};
+
+ self.name = function () {
+ return name;
+ };
+
+ return self;
+};
--- /dev/null
+tr.models.Quadrant = function (name) {
+ var self, blips;
+
+ self = {};
+ blips = [];
+
+ self.name = function () {
+ return name;
+ };
+
+ self.add = function (newBlips) {
+ if (Array.isArray(newBlips)) {
+ blips = blips.concat(newBlips);
+ } else {
+ blips.push(newBlips);
+ }
+ };
+
+ self.blips = function () {
+ return blips.slice(0);
+ };
+
+ return self;
+};
--- /dev/null
+var tr = tr || {};
+tr.models = {};
+tr.graphing = {};
--- /dev/null
+describe('tr.models.Blip', function () {
+ it('has a name', function () {
+ var blip = new tr.models.Blip('My Blip');
+
+ expect(blip.name()).toEqual('My Blip');
+ });
+
+ it('has a cycle', function () {
+ var blip = new tr.models.Blip(
+ 'My Blip',
+ new tr.models.Cycle('My Cycle')
+ );
+
+ expect(blip.cycle().name()).toEqual('My Cycle');
+ });
+
+ it('is new', function () {
+ var blip = new tr.models.Blip(
+ 'My Blip',
+ new tr.models.Cycle('My Cycle'),
+ true
+ );
+
+ expect(blip.isNew()).toBe(true);
+ });
+
+ it('is not new', function () {
+ var blip = new tr.models.Blip(
+ 'My Blip',
+ new tr.models.Cycle('My Cycle'),
+ false
+ );
+
+ expect(blip.isNew()).toBe(false);
+ });
+});
--- /dev/null
+describe('tr.models.Cycle', function () {
+ it('has a name', function () {
+ var cycle = new tr.models.Cycle('My Cycle');
+
+ expect(cycle.name()).toEqual('My Cycle');
+ });
+});
--- /dev/null
+describe('tr.models.Quadrant', function () {
+ it('has a name', function () {
+ var quadrant = new tr.models.Quadrant('My Quadrant');
+
+ expect(quadrant.name()).toEqual('My Quadrant');
+ });
+
+ it('has no blips by default', function () {
+ var quadrant = new tr.models.Quadrant('My Quadrant');
+
+ expect(quadrant.blips()).toEqual([]);
+ });
+
+ it('can add a single blip', function () {
+ var quadrant = new tr.models.Quadrant('My Quadrant');
+
+ quadrant.add(new tr.models.Blip());
+
+ expect(quadrant.blips().length).toEqual(1);
+ });
+
+ it('can add multiple blips', function () {
+ var quadrant = new tr.models.Quadrant('My Quadrant');
+
+ quadrant.add([new tr.models.Blip(), new tr.models.Blip()]);
+
+ expect(quadrant.blips().length).toEqual(2);
+ });
+});