ABPCMS.Web/lib/chart.js/test/specs/global.defaults.tests.js

(开头部分) 7KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

// Test the bubble chart default config
describe('Default Configs', function() {
	describe('Bubble Chart', function() {
		it('should return correct tooltip strings', function() {
			var config = Chart.defaults.bubble;
			var chart = window.acquireChart({
				type: 'bubble',
				data: {
					datasets: [{
						label: 'My dataset',
						data: [{
							x: 10,
							y: 12,
							r: 5
						}]
					}]
				},
				options: config
			});

			// fake out the tooltip hover and force the tooltip to update
			chart.tooltip._active = [chart.getDatasetMeta(0).data[0]];
			chart.tooltip.update();

			// Title is always blank
			expect(chart.tooltip._model.title).toEqual([]);
			expect(chart.tooltip._model.body).toEqual([{
				before: [],
				lines: ['My dataset: (10, 12, 5)'],
				after: []
			}]);
		});
	});

	describe('Doughnut Chart', function() {
		it('should return correct tooltip strings', function() {
			var config = Chart.defaults.doughnut;
			var chart = window.acquireChart({
				type: 'doughnut',
				data: {
					labels: ['label1', 'label2', 'label3'],
					datasets: [{
						data: [10, 20, 30],
					}]
				},
				options: config
			});

			// fake out the tooltip hover and force the tooltip to update
			chart.tooltip._active = [chart.getDatasetMeta(0).data[1]];
			chart.tooltip.update();

			// Title is always blank
			expect(chart.tooltip._model.title).toEqual([]);
			expect(chart.tooltip._model.body).toEqual([{
				before: [],
				lines: ['label2: 20'],
				after: []
			}]);
		});
后面还有 236 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。