package eu.ydp.empiria.player.client.module.button;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.when;

import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;

import eu.ydp.empiria.player.client.controller.events.delivery.DeliveryEvent;
import eu.ydp.empiria.player.client.controller.events.delivery.DeliveryEventType;

public class FeedbackAudioMuteButtonModuleTest {

	private FeedbackAudioMuteButtonModule button;

	@Before
	public void initTest() {
		button = org.mockito.Mockito.mock(FeedbackAudioMuteButtonModule.class, Mockito.CALLS_REAL_METHODS);
		doNothing().when(button).updateStyleName();
	}

	@Test
	public void testChangeStyleOnTestPageLoadedExpectsVisibleWhenPageContainsInteractiveModules() {
		when(button.hasItemInteractiveModules()).thenReturn(true);

		button.onDeliveryEvent(new DeliveryEvent(DeliveryEventType.TEST_PAGE_LOADED));

		String expected = FeedbackAudioMuteButtonModule.STYLE_NAME__OFF;
		assertThat(button.getStyleName(), equalTo(expected));
	}

	@Test
	public void testChangeStyleOnTestPageLoadedExpectsHiddenWhenPageContainsInteractiveModules() {
		when(button.hasItemInteractiveModules()).thenReturn(false);

		button.onDeliveryEvent(new DeliveryEvent(DeliveryEventType.TEST_PAGE_LOADED));

		String expected = FeedbackAudioMuteButtonModule.STYLE_NAME__OFF + " " + FeedbackAudioMuteButtonModule.STYLE_NAME__DISABLED;
		assertThat(button.getStyleName(), equalTo(expected));
	}
}

@@ -358,43 +358,33 @@
 ent.
-controller.events.delivery.Deliv
+util.events.player.Play
 er
-y
 Even
@@ -427,43 +427,33 @@
 ent.
-controller.events.delivery.Deliv
+util.events.player.Play
 er
-y
 Even
@@ -457,16 +457,17 @@
 ventType
+s
 ;%0D%0A%0D%0Apub
@@ -922,24 +922,26 @@
 urn(true);%0D%0A
+%09%09
 %0D%0A%09%09button.o
@@ -937,32 +937,30 @@
 %0A%09%09button.on
-Deliv
+Play
 er
-y
 Event(new De
@@ -957,38 +957,34 @@
 ent(new 
-Deliv
+Play
 er
-y
 Event(
-Deliv
+Play
 er
-y
 EventTyp
@@ -976,38 +976,34 @@
 (PlayerEventType
+s
 .
-TEST_
 PAGE_LOADED));%0D%0A
@@ -1299,24 +1299,26 @@
 rn(false);%0D%0A
+%09%09
 %0D%0A%09%09button.o
@@ -1318,24 +1318,22 @@
 utton.on
-Deliv
+Play
 er
-y
 Event(ne
@@ -1338,30 +1338,26 @@
 new 
-Deliv
+Play
 er
-y
 Event(
-Deliv
+Play
 er
-y
 Even
@@ -1365,14 +1365,10 @@
 Type
+s
 .
-TEST_
 PAGE

test update issue YPUB-5021