1
0
mirror of https://gitlab.com/JKANetwork/CheckServer.git synced 2026-03-02 08:53:46 +01:00

Start again

This commit is contained in:
2020-10-04 17:14:00 +02:00
parent c0d3912413
commit 091f119048
4382 changed files with 1762543 additions and 9606 deletions

View File

@@ -0,0 +1,68 @@
describe('angular easypiechart directive', function() {
var $compile, $rootScope, scope;
beforeEach(module('easypiechart'));
beforeEach(inject(function(_$compile_, $rootScope){
scope = $rootScope;
$compile = _$compile_;
}));
it('should have percentage default value 0', function (done) {
scope.percent = null;
var element = angular.element('<div easypiechart percent="percent" options="options"></div>');
$compile(element)(scope);
scope.$digest();
expect(element.isolateScope().percent).toBe(0);
});
it('inserts the element with a canvas element', function() {
scope.percent = -45;
scope.options = {};
var element = angular.element('<div easypiechart percent="percent" options="options"></div>');
$compile(element)(scope);
scope.$digest();
expect(element.html()).toContain('canvas');
});
it('gets the options right', function (done) {
scope.percent = 0;
scope.options = {
animate:{
duration:0,
enabled:false
},
barColor:'#2C3E50',
scaleColor:false,
lineWidth:20,
lineCap:'circle'
};
var element = angular.element('<div easypiechart percent="percent" options="options"></div>');
$compile(element)(scope);
scope.$digest();
expect(element.isolateScope().options.animate.duration).toBe(0);
expect(element.isolateScope().options.lineCap).toBe('circle');
});
it('has its own default options', function (done) {
scope.percent = 0;
scope.options = {};
var element = angular.element('<div easypiechart percent="percent" options="options"></div>');
$compile(element)(scope);
scope.$digest();
expect(element.isolateScope().options.size).toBe(110);
expect(element.isolateScope().options.animate.enabled).toBe(true);
});
it('takes size option the right way', function() {
scope.percent = 0;
scope.options = {
size: 200
};
var element = angular.element('<div easypiechart percent="percent" options="options"></div>');
$compile(element)(scope);
scope.$digest();
expect(element.html()).toContain('height="200"');
expect(element.html()).toContain('width="200"');
});
});

View File

@@ -0,0 +1,61 @@
describe('Unit testing jQuery version of easy pie chart', function() {
var $el;
var createInstance = function(options, el) {
options = options || {};
el = el || '<span class="chart"></span>';
return function() {
$el = $(el);
$('body').append($el);
$el.easyPieChart(options);
};
};
describe('initialize plugin', function() {
beforeEach(createInstance());
it('should insert a canvas element', function() {
expect($el.html()).toContain('canvas');
});
});
describe('takes size option and', function() {
var $canvas;
beforeEach(createInstance({
size: 200
}));
beforeEach(function() {
$canvas = $el.find('canvas');
});
it('set correct width', function() {
expect($canvas.width()).toBe(200);
});
it('set correct height', function() {
expect($canvas.height()).toBe(200);
});
});
describe('options should be overwritable by data attributes', function() {
var $canvas;
beforeEach(createInstance({
size: 200
}, '<span class="chart" data-size="400"></span>'));
beforeEach(function() {
$canvas = $el.find('canvas');
});
it('overwrite width', function() {
expect($canvas.width()).toBe(400);
});
it('overwrite height', function() {
expect($canvas.height()).toBe(400);
});
});
});