1 package net.systemeD.halcyon.connection.actions {
3 import org.flexunit.Assert;
4 import net.systemeD.halcyon.connection.actions.AddMemberToRelationAction;
5 import net.systemeD.halcyon.connection.Relation;
6 import net.systemeD.halcyon.connection.Node;
7 import net.systemeD.halcyon.connection.RelationMember;
8 import net.systemeD.halcyon.connection.UndoableAction;
9 import net.systemeD.halcyon.connection.*;
11 public class AddMemberToRelationActionTest {
14 public function addMember():void {
16 var n:Node = new Node(1,1,{},true,5,10);
18 var rel:Relation = new Relation(1,1,{},true,[]);
19 var member:RelationMember = new RelationMember(n, "foo");
21 //Instantiate the connection first to prevent errors
22 Connection.getConnection();
23 rel.appendMember(member, function(action:UndoableAction):void { action.doAction(); })
24 Assert.assertEquals(1, rel.length);
29 public function spliceStuff():void {
32 var arr:Array = ["a", "b", "c", "d"];
33 Assert.assertEquals(4, arr.length);
35 // doesn't actually splice onto the end, inserts at position 4
36 arr.splice(-1, 0, "e");
37 Assert.assertEquals(5, arr.length);
38 Assert.assertEquals("e", arr[3]);
39 Assert.assertEquals("d", arr[4]);