<commit_before>/* brackets-xunit: includes=../src/radial.js */

describe('Exists Radial class', function(){
	
	it('and it\'s in Window', function(){
		expect(window.Radial).toBeDefined();
	});
	
});

var myItems = [
	{
		html: 'testing',
	}
];

var radial = new Radial(myItems);

describe('Pass some items to the constructor', function(){
	
	it('and these items are in array', function(){
		expect(radial.count()).toBeDefined();
	});
	
	it('and Radial extends every item options', function(){
		expect(myItems[0].target).toBeUndefined();
		expect(radial.get(0).target).toEqual('_blank');
	});
	
	it('and item can be rendered', function(){
		expect(typeof radial.renderItem(0)).toEqual('string');
	});

});

describe('Manage the list',function(){
	it('and can add new item', function(){
		expect(radial.count()).toEqual(1);
		radial.add({html: 'second test'});
		expect(radial.count()).toEqual(2);
	});
	
	it('and can add some items', function(){
		expect(radial.count()).toEqual(2);
		radial.add([{html: 'third test'}, {html: 'last test'}]);
		expect(radial.count()).toEqual(4);
	});
	
	it('and can edit an item', function(){
		expect(radial.get(3).html).toEqual('last test');
		radial.get(3).html = 'edited';
		expect(radial.get(3).html).toEqual('edited');
	});
	
	it('and can remove an item', function(){
		expect(radial.count()).toEqual(4);
		radial.remove(3);
		expect(radial.count()).toEqual(3);
	});
});

/*describe('Showing items', function(){
	it('and can show single item');
	it('and can show all items');
});*/<commit_msg>Add test Calculate positions<commit_after>/* brackets-xunit: includes=../src/radial.js */

describe('Exists Radial class', function(){
	
	it('and it\'s in Window', function(){
		expect(window.Radial).toBeDefined();
	});
	
});

describe('Pass some items to the constructor', function(){
	var myItems = [{html: 'testing'}];
	var radial = new Radial(myItems);
	
	it('and these items are in array', function(){
		expect(radial.count()).toBeDefined();
	});
	
	it('and Radial extends every item options', function(){
		expect(myItems[0].target).toBeUndefined();
		expect(radial.get(0).target).toEqual('_blank');
	});
	
	it('and item can be rendered', function(){
		expect(typeof radial.renderItem(0)).toEqual('string');
	});

});

describe('Manage the list', function(){
	var myItems = [{html: 'testing'}];
	var radial = new Radial(myItems);
	
	it('and can add new item', function(){
		expect(radial.count()).toEqual(1);
		radial.add({html: 'second test'});
		expect(radial.count()).toEqual(2);
	});
	
	it('and can add some items', function(){
		expect(radial.count()).toEqual(2);
		radial.add([{html: 'third test'}, {html: 'last test'}]);
		expect(radial.count()).toEqual(4);
	});
	
	it('and can edit an item', function(){
		expect(radial.get(3).html).toEqual('last test');
		radial.get(3).html = 'edited';
		expect(radial.get(3).html).toEqual('edited');
	});
	
	it('and can remove an item', function(){
		expect(radial.count()).toEqual(4);
		radial.remove(3);
		expect(radial.count()).toEqual(3);
	});
});

describe('Calculate positions', function(){
	var myItems = [{html: 1},{html: 2},{html: 3},{html: 4}];
	var radial = new Radial(myItems);

	it('and 4 items paint a cross', function(){
		expect(radial.count()).toEqual(4);
		expect(radial.getAlfa(0)).toEqual(0);
		radial.calc();
		expect(radial.getAlfa(0)).toEqual(0);
		expect(radial.getAlfa(1)).toEqual(90);
		expect(radial.getAlfa(2)).toEqual(180);
		expect(radial.getAlfa(3)).toEqual(270);
	});
	
	it('and 8 items paint a circle', function(){
		var myItems2 = [{html: 5},{html: 6},{html: 7},{html: 8}];
		radial.add(myItems2);
		expect(radial.count()).toEqual(8);
		radial.calc();
		expect(radial.getAlfa(0)).toEqual(0);
		expect(radial.getAlfa(1)).toEqual(45);
		expect(radial.getAlfa(2)).toEqual(90);
		expect(radial.getAlfa(3)).toEqual(135);
		expect(radial.getAlfa(4)).toEqual(180);
		expect(radial.getAlfa(5)).toEqual(225);
		expect(radial.getAlfa(6)).toEqual(270);
		expect(radial.getAlfa(7)).toEqual(315);
	});
});

/*describe('Showing items', function(){
	it('and can show single item');
	it('and can show all items');
});*/
{'fraction_non_alphanumeric': 0.21582908472930323, 'fraction_numerical': 0.02015052197135227, 'mean_word_length': 5.195488721804511, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5471772', 'n_tokens_mistral': 1543, 'n_tokens_neox': 1442, 'n_words': 293}