Skip to content

Commit

Permalink
Merge pull request #4 from hendrathings/features/feature-test-karma
Browse files Browse the repository at this point in the history
Features/feature test karma
hendrathings authored Jan 15, 2017
2 parents 400b745 + ee4c779 commit f8776d8
Showing 20 changed files with 1,467 additions and 15 deletions.
3 changes: 2 additions & 1 deletion . npmignore
Original file line number Diff line number Diff line change
@@ -4,4 +4,5 @@ npm-debug.log

# OS generated files
Thumbs.db
.DS_Store
.DS_Store
coverage
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -4,4 +4,5 @@ npm-debug.log

# OS generated files
Thumbs.db
.DS_Store
.DS_Store
coverage
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -87,18 +87,18 @@ all chaining function use ase json...
bottom: 40,
left: 55
},
x: function (d) { return d.x; },
y: function (d) { return d.y; },
x: (d) => { return d.x; },
y: (d) => { return d.y; },
xScale: d3.time.scale(),
xAxis: {
ticks: d3.time.months,
tickFormat: function (d) {
tickFormat: (d) => {
return d3.time.format('%b')(new Date(d));
}
},
yAxis: {
axisLabel: 'Gross volume',
tickFormat: function (d) {
tickFormat: (d) => {
if (d == null) {
return 0;
}
6 changes: 1 addition & 5 deletions dist/angular2-nvd3/angular2-nvd3.module.js
Original file line number Diff line number Diff line change
@@ -5,9 +5,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1 = require("@angular/core");
var angular2_nvd3_component_1 = require("./angular2-nvd3.component");
var angular2_nvd3_directive_1 = require("./angular2-nvd3.directive");
@@ -26,7 +23,6 @@ NvD3Module = __decorate([
angular2_nvd3_component_1.NvD3Component,
angular2_nvd3_directive_1.NvD3Directive
]
}),
__metadata("design:paramtypes", [])
})
], NvD3Module);
exports.NvD3Module = NvD3Module;
Empty file.
33 changes: 33 additions & 0 deletions dist/test/angular2-nvd3.component.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"use strict";
var testing_1 = require("@angular/core/testing");
var angular2_nvd3_component_1 = require("../angular2-nvd3/angular2-nvd3.component");
var sample_data_1 = require("./sample-data");
sample_data_1.SampleData.chartTypes.forEach(function (type) {
describe("tasks:NvD3Component " + type, function () {
var component;
var fixture;
var componentElement;
beforeEach(function () {
testing_1.TestBed.configureTestingModule({
declarations: [angular2_nvd3_component_1.NvD3Component],
});
fixture = testing_1.TestBed.createComponent(angular2_nvd3_component_1.NvD3Component);
component = fixture.componentInstance;
component.options = sample_data_1.SampleData.allOptions[type];
component.data = sample_data_1.SampleData.allData[type];
fixture.detectChanges();
componentElement = fixture.nativeElement;
});
it("should have svg", function () {
expect(componentElement.querySelectorAll('svg').length).toBe(1);
});
it('should svg have class nvd3-svg', function () {
var gElement = componentElement.querySelector('svg');
expect(gElement.classList).toContain('nvd3-svg');
});
it("should g have class nv-" + type, function () {
var gElement = componentElement.querySelector('g');
expect(gElement.className.baseVal).toContain(sample_data_1.SampleData.chartClassExpected[type]);
});
});
});
Loading

0 comments on commit f8776d8

Please sign in to comment.