123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- describe('settings', () => {
- describe('tableClassName', () => {
- var id = 'testContainer';
- beforeEach(function() {
- this.$container = $(`<div id="${id}"></div>`).appendTo('body');
- });
- afterEach(function() {
- if (this.$container) {
- destroy();
- this.$container.remove();
- }
- });
- it('should add class name every table element inside handsontable wrapper element (as string, without overlays)', () => {
- var hot = handsontable({
- colHeaders: false,
- rowHeaders: false,
- tableClassName: 'foo'
- });
- var possibleCounts = [3, 4]; // 3 for non-pro, 4 for pro (bottom overlay)
- // all overlays is created anyway but without left-top corner
- expect(possibleCounts.indexOf(hot.rootElement.querySelectorAll('table.foo').length)).toBeGreaterThan(-1);
- });
- it('should add class name every table element inside handsontable wrapper element (as string, with overlays)', () => {
- var hot = handsontable({
- colHeaders: true,
- rowHeaders: true,
- tableClassName: 'foo'
- });
- var possibleCounts = [4, 5]; // 4 for non-pro, 5 for pro (bottom overlay)
- expect(possibleCounts.indexOf(hot.rootElement.querySelectorAll('table.foo').length)).toBeGreaterThan(-1);
- });
- it('should add class name every table element inside handsontable wrapper element (as string with spaces, without overlays)', () => {
- var hot = handsontable({
- colHeaders: false,
- rowHeaders: false,
- tableClassName: 'foo bar'
- });
- var possibleCounts = [3, 4]; // 3 for non-pro, 4 for pro (bottom overlay)
- // all overlays is created anyway but without left-top corner
- expect(possibleCounts.indexOf(hot.rootElement.querySelectorAll('table.foo').length)).toBeGreaterThan(-1);
- expect(possibleCounts.indexOf(hot.rootElement.querySelectorAll('table.bar').length)).toBeGreaterThan(-1);
- });
- it('should add class name every table element inside handsontable wrapper element (as string with spaces, with overlays)', () => {
- var hot = handsontable({
- colHeaders: true,
- rowHeaders: true,
- tableClassName: 'foo bar'
- });
- var possibleCounts = [4, 5]; // 4 for non-pro, 5 for pro (bottom overlay)
- expect(possibleCounts.indexOf(hot.rootElement.querySelectorAll('table.foo').length)).toBeGreaterThan(-1);
- expect(possibleCounts.indexOf(hot.rootElement.querySelectorAll('table.bar').length)).toBeGreaterThan(-1);
- });
- it('should add class name every table element inside handsontable wrapper element (as array, without overlays)', () => {
- var hot = handsontable({
- colHeaders: false,
- rowHeaders: false,
- tableClassName: ['foo', 'bar', 'baz']
- });
- var possibleCounts = [3, 4]; // 3 for non-pro, 4 for pro (bottom overlay)
- expect(possibleCounts.indexOf(hot.rootElement.querySelectorAll('table.foo').length)).toBeGreaterThan(-1);
- expect(possibleCounts.indexOf(hot.rootElement.querySelectorAll('table.bar').length)).toBeGreaterThan(-1);
- expect(possibleCounts.indexOf(hot.rootElement.querySelectorAll('table.baz').length)).toBeGreaterThan(-1);
- });
- it('should add class name every table element inside handsontable wrapper element (as array, with overlays)', () => {
- var hot = handsontable({
- colHeaders: true,
- rowHeaders: true,
- tableClassName: ['foo', 'bar', 'baz']
- });
- var possibleCounts = [4, 5]; // 4 for non-pro, 5 for pro (bottom overlay)
- expect(possibleCounts.indexOf(hot.rootElement.querySelectorAll('table.foo').length)).toBeGreaterThan(-1);
- expect(possibleCounts.indexOf(hot.rootElement.querySelectorAll('table.bar').length)).toBeGreaterThan(-1);
- expect(possibleCounts.indexOf(hot.rootElement.querySelectorAll('table.baz').length)).toBeGreaterThan(-1);
- });
- });
- });
|