File: columns_ariaTitle.js

package info (click to toggle)
datatables.js 1.11.5%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 22,848 kB
  • sloc: javascript: 65,075; xml: 10,712; php: 4,741; sh: 544; makefile: 18
file content (34 lines) | stat: -rw-r--r-- 1,172 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
describe('columns.ariaTitle option', function () {
	dt.libs({
		js: ['jquery', 'datatables'],
		css: ['datatables']
	});

	describe('Check the option', function () {
		dt.html('basic');
		it('Defaults', function () {
			$('#example').dataTable({
				columnDefs: [
					{targets: 0, ariaTitle: 'test1'},
					{targets: 1, title: 'test2'},
					{targets: 2, ariaTitle: 'test3a', title: 'test3t'}
				]
			});

			expect($('thead th:eq(3)').attr('aria-label')).toBe('Age: activate to sort column ascending');
			expect($('thead th:eq(3)').text()).toBe('Age');
		});
		it('Just ariaTitle', function () {
			expect($('thead th:eq(0)').attr('aria-label')).toBe('test1: activate to sort column descending');
			expect($('thead th:eq(0)').text()).toBe('Name');
		});
		it('Just ariaTitle', function () {
			expect($('thead th:eq(1)').attr('aria-label')).toBe('test2: activate to sort column ascending');
			expect($('thead th:eq(1)').text()).toBe('test2');
		});
		it('Both ariaTitle and title', function () {
			expect($('thead th:eq(2)').attr('aria-label')).toBe('test3a: activate to sort column ascending');
			expect($('thead th:eq(2)').text()).toBe('test3t');
		});
	});
});