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

describe('CompositeCommandManager', () => {
	let arrayOfCommands = [],
		i = 5,
		arr = [],
		tableWithFocus = {view: {isFocused: () => true}},
		tableWithoutFocus = {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, tableWithFocus);
			let filtered = tableCommandManager.filter(arrayOfCommands);
			expect(filtered.length).to.equal(2);
		});

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

});


@@ -104,24 +104,17 @@
  %7B%0A%09let 
-arrayOfC
+c
 ommands 
@@ -306,32 +306,25 @@
 === 0) %7B%0A%09%09%09
-arrayOfC
+c
 ommands.push
@@ -406,24 +406,17 @@
 se %7B%0A%09%09%09
-arrayOfC
+c
 ommands.
@@ -719,32 +719,25 @@
 ager.filter(
-arrayOfC
+c
 ommands);%0A%09%09
@@ -974,16 +974,9 @@
 ter(
-arrayOfC
+c
 omma

Update table.command.manager.spec.js