import {TableCommandManager} from './table.command.manager';

describe('CompositeCommandManager', () => {
	let arrayOfCommands = [],
		i = 5,
		arr = [],
		testTable1 = {view: {isFocused: () => true}},
		testTable2 = {view: {isFocused: () => false}},
		apply = f => f();

	while (i > 0) {
		if (i % 2 === 0) {
			arrayOfCommands.push({
				execute: () => arr.push(1),
				canExecute: () => true
			});
		} else {
			arrayOfCommands.push({
				execute: () => arr.push(2),
				canExecute: () => false
			});
		}
		i--;
	}

	describe('filter', () => {
		it('should return filtered commands if ViewActive = true', () => {
			let tableCommandManager = new TableCommandManager(apply, testTable1);
			let filtered = tableCommandManager.filter(arrayOfCommands);
			expect(filtered.length).to.equal(2);
		});

		it('should return empty array if ViewActive = false', () => {
			let tableCommandManager = new TableCommandManager(apply, testTable2);
			let filtered = tableCommandManager.filter(arrayOfCommands);
			expect(filtered.length).to.equal(0);
		});
	});

});

@@ -150,25 +150,29 @@
  %5B%5D,%0A%09%09t
-estTable1
+ableWithFocus
  = %7Bview
@@ -202,25 +202,32 @@
 e%7D%7D,%0A%09%09t
-estTable2
+ableWithoutFocus
  = %7Bview
@@ -687,17 +687,21 @@
 y, t
-estTable1
+ableWithFocus
 );%0A%09
@@ -938,17 +938,24 @@
 y, t
-estTable2
+ableWithoutFocus
 );%0A%09
@@ -1068,12 +1068,13 @@
 ;%0A%09%7D);%0A%0A%7D);%0A
+%0A

Update table.command.manager.spec.js