Package com.googlecode.gwt.test

Source Code of com.googlecode.gwt.test.PushButtonTest

package com.googlecode.gwt.test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.PushButton;
import com.googlecode.gwt.test.utils.events.Browser;

public class PushButtonTest extends GwtTestTest {

   private boolean clicked;

   @Test
   public void click() {
      // Arrange
      clicked = false;

      final PushButton b = new PushButton("Up", "Down");

      b.addClickHandler(new ClickHandler() {

         public void onClick(ClickEvent event) {
            clicked = true;
         }
      });

      // Pre-Assert
      assertEquals("Up", b.getText());

      // Act
      Browser.click(b);

      // Assert
      assertTrue("PushButton onClick was not triggered", clicked);
      assertEquals("Up", b.getText());
   }

}
TOP

Related Classes of com.googlecode.gwt.test.PushButtonTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.