Sha256: f53af28a923722f8752f3e76e8863faa3dec9e957eb70215fc80f440d2aa2c6f

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

package org.osflash.signals
{
	import asunit.asserts.*;

	import org.osflash.signals.events.GenericEvent;
	import org.osflash.signals.events.IEvent;

	public class GenericEventTest
	{
		private var instance:GenericEvent;

		[Before]
		public function setUp():void
		{
			instance = new GenericEvent();
		}

		[After]
		public function tearDown():void
		{
			instance = null;
		}

		public function testInstantiated():void
		{
			assertTrue("GenericEvent instantiated", instance is GenericEvent);
			assertNull('target is null by default', instance.target);
			assertFalse('bubbles is false by default', instance.bubbles);
		}
		
		[Test]
		public function bubbles_roundtrips_through_constructor():void
		{
			var bubblingEvent:GenericEvent = new GenericEvent(true);
			assertTrue(bubblingEvent.bubbles);
		}
		
		[Test]
		public function clone_should_be_instance_of_original_event_class():void
		{
			var theClone:IEvent = instance.clone();
			assertTrue(theClone is GenericEvent);
		}
		
		[Test]
		public function clone_non_bubbling_event_should_have_bubbles_false():void
		{
			var theClone:GenericEvent = GenericEvent(instance.clone());
			assertFalse(theClone.bubbles);
		}
		
		[Test]
		public function clone_bubbling_event_should_have_bubbles_true():void
		{
			var bubblingEvent:GenericEvent = new GenericEvent(true);
			var theClone:IEvent = bubblingEvent.clone();
			assertTrue(theClone.bubbles);
		}


	}
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
as3signals-0.7.1 tests/org/osflash/signals/GenericEventTest.as
as3signals-0.7.0 tests/org/osflash/signals/GenericEventTest.as