'use strict';

var VocabularyUser = require('./vocabulary.user');
var vocabularyUser = new VocabularyUser();

xdescribe('Vocabulary', function() {

	beforeEach(function() {

		return vocabularyUser.goToVocabulary();

	});


	describe('USE CASE: Visualize Vocabulary', function() {

		it('when user accesses vocabulary, then only 10 items appear, with the proper style', function() {
			return vocabularyUser.countNumberOfTerms()
				.then(function(number) {
					expect(number).toBe(20);
				});
		});

		it('when user accesses vocabulary, and clicks on Next page, then other 10 items appear', function() {
			return vocabularyUser.clickOnNextPage()
				.then(function() {
					return vocabularyUser.countNumberOfTerms();
				})
				.then(function(number) {
					expect(number).toBe(40);
				});
		});

	});

	describe('USE CASE: Archive item', function() {

		it('when user archives an item to vocabulary, then it has a green background', function() {
			var color = vocabularyUser.convertHex('#BF8E90');

			return vocabularyUser.archiveItemByIndex(0)
				.then(function() {
					return vocabularyUser.getBackgroundColorOfItemByIndex(0);
				})
				.then(function(c) {
					expect(c).toBe(color);
				});
		});


	});
	describe('USE CASE: Add item to vocabulary', function() {

		it('when user adds an item to vocabulary, then it has a green background', function() {
			var color= vocabularyUser.convertHex('#58B679');

			return vocabularyUser.makeItemValidByIndex(1)
				.then(function() {
					return vocabularyUser.getBackgroundColorOfItemByIndex(1);
				})
				.then(function(c) {
					expect(c).toBe(color);
				});
		});
	});

});