Package net.mindengine.galen.specs.page

Examples of net.mindengine.galen.specs.page.ConditionalBlock


       
        PageSection pageSection = sections.get(0);
        List<ConditionalBlock> blocks = pageSection.getConditionalBlocks();
        assertThat(blocks.size(), is(1));
       
        ConditionalBlock block = blocks.get(0);
        List<ConditionalBlockStatement> statements = block.getStatements();
        assertThat(statements.size(), is(1));
        ConditionalBlockStatement statement = statements.get(0);
        assertThat(statement.isInverted(), is(false));
       
        List<ObjectSpecs> statementObjects = statement.getObjects();
        assertThat(statementObjects.size(), is(2));
        assertThat(statementObjects.get(0).getObjectName(), is("button-1"));
        assertThat(statementObjects.get(0).getSpecs().get(0).getOriginalText(), is("width: > 100px"));
        assertThat(statementObjects.get(1).getObjectName(), is("button-2"));
        assertThat(statementObjects.get(1).getSpecs().get(0).getOriginalText(), is("height: < 50px"));
        assertThat(statementObjects.get(1).getSpecs().get(1).getOriginalText(), is("width: 200px"));
       
        List<ObjectSpecs> bodyObjects = block.getBodyObjects();
        assertThat(bodyObjects.size(), is(2));
        assertThat(bodyObjects.get(0).getObjectName(), is("button-1"));
        assertThat(bodyObjects.get(0).getSpecs().get(0).getOriginalText(), is("above: button-2 0px"));
        assertThat(bodyObjects.get(1).getObjectName(), is("button-2"));
        assertThat(bodyObjects.get(1).getSpecs().get(0).getOriginalText(), is("below: button-1 0px"));
View Full Code Here


       
        PageSection pageSection = sections.get(0);
        List<ConditionalBlock> blocks = pageSection.getConditionalBlocks();
        assertThat(blocks.size(), is(1));
       
        ConditionalBlock block = blocks.get(0);
        List<ConditionalBlockStatement> statements = block.getStatements();
        assertThat(statements.size(), is(3));
       
        {
            ConditionalBlockStatement statement = statements.get(0);
            assertThat(statement.isInverted(), is(false));
            List<ObjectSpecs> statementObjects = statement.getObjects();
            assertThat(statementObjects.size(), is(1));
            assertThat(statementObjects.get(0).getObjectName(), is("button-1"));
            assertThat(statementObjects.get(0).getSpecs().get(0).getOriginalText(), is("width: > 100px"));
        }
        {
            ConditionalBlockStatement statement = statements.get(1);
            assertThat(statement.isInverted(), is(false));
            List<ObjectSpecs> statementObjects = statement.getObjects();
            assertThat(statementObjects.size(), is(1));
            assertThat(statementObjects.get(0).getObjectName(), is("button-2"));
            assertThat(statementObjects.get(0).getSpecs().get(0).getOriginalText(), is("width: 200px"));
        }
        {
            ConditionalBlockStatement statement = statements.get(2);
            assertThat(statement.isInverted(), is(false));
            List<ObjectSpecs> statementObjects = statement.getObjects();
            assertThat(statementObjects.size(), is(1));
            assertThat(statementObjects.get(0).getObjectName(), is("button-3"));
            assertThat(statementObjects.get(0).getSpecs().get(0).getOriginalText(), is("width: 200px"));
        }
       
        List<ObjectSpecs> bodyObjects = block.getBodyObjects();
        assertThat(bodyObjects.size(), is(2));
        assertThat(bodyObjects.get(0).getObjectName(), is("button-1"));
        assertThat(bodyObjects.get(0).getSpecs().get(0).getOriginalText(), is("text is: sample text"));
        assertThat(bodyObjects.get(1).getObjectName(), is("button-2"));
        assertThat(bodyObjects.get(1).getSpecs().get(0).getOriginalText(), is("text ends: something"));
View Full Code Here

       
        PageSection pageSection = sections.get(0);
        List<ConditionalBlock> blocks = pageSection.getConditionalBlocks();
        assertThat(blocks.size(), is(1));
       
        ConditionalBlock block = blocks.get(0);
        List<ConditionalBlockStatement> statements = block.getStatements();
        assertThat(statements.size(), is(2));
       
        {
            ConditionalBlockStatement statement = statements.get(0);
            assertThat(statement.isInverted(), is(true));
            List<ObjectSpecs> statementObjects = statement.getObjects();
            assertThat(statementObjects.size(), is(1));
            assertThat(statementObjects.get(0).getObjectName(), is("button-1"));
            assertThat(statementObjects.get(0).getSpecs().get(0).getOriginalText(), is("width: > 100px"));
        }
        {
            ConditionalBlockStatement statement = statements.get(1);
            assertThat(statement.isInverted(), is(true));
            List<ObjectSpecs> statementObjects = statement.getObjects();
            assertThat(statementObjects.size(), is(1));
            assertThat(statementObjects.get(0).getObjectName(), is("button-2"));
            assertThat(statementObjects.get(0).getSpecs().get(0).getOriginalText(), is("width: 200px"));
        }
       
        List<ObjectSpecs> bodyObjects = block.getBodyObjects();
        assertThat(bodyObjects.size(), is(2));
        assertThat(bodyObjects.get(0).getObjectName(), is("button-1"));
        assertThat(bodyObjects.get(0).getSpecs().get(0).getOriginalText(), is("text is: sample text"));
        assertThat(bodyObjects.get(1).getObjectName(), is("button-2"));
        assertThat(bodyObjects.get(1).getSpecs().get(0).getOriginalText(), is("text ends: something"));
View Full Code Here

       
        PageSection pageSection = sections.get(0);
        List<ConditionalBlock> blocks = pageSection.getConditionalBlocks();
        assertThat(blocks.size(), is(1));
       
        ConditionalBlock block = blocks.get(0);
        List<ConditionalBlockStatement> statements = block.getStatements();
        assertThat(statements.size(), is(1));
       
        {
            ConditionalBlockStatement statement = statements.get(0);
            assertThat(statement.isInverted(), is(false));
            List<ObjectSpecs> statementObjects = statement.getObjects();
            assertThat(statementObjects.size(), is(1));
            assertThat(statementObjects.get(0).getObjectName(), is("button-1"));
            assertThat(statementObjects.get(0).getSpecs().get(0).getOriginalText(), is("width: > 100px"));
        }
       
        List<ObjectSpecs> bodyObjects = block.getBodyObjects();
        assertThat(bodyObjects.size(), is(1));
        assertThat(bodyObjects.get(0).getObjectName(), is("button-1"));
        assertThat(bodyObjects.get(0).getSpecs().get(0).getOriginalText(), is("text is: sample text"));
       
       
        List<ObjectSpecs> otherwiseObjects = block.getOtherwiseObjects();
        assertThat(otherwiseObjects.size(), is(1));
        assertThat(otherwiseObjects.get(0).getObjectName(), is("button-2"));
        assertThat(otherwiseObjects.get(0).getSpecs().get(0).getOriginalText(), is("text ends: something"));
    }
View Full Code Here

    @Test
    public void shouldAllowTo_mixConditionalStatements_withParameterizations() throws IOException {
        PageSpecReader specReader = new PageSpecReader(new Properties(), null);
        PageSpec pageSpec = specReader.read(getClass().getResource("/specs/mix-conditions-with-parameterizations.spec").getFile());
        ConditionalBlock conditionalBlock = pageSpec.getSections().get(0).getConditionalBlocks().get(0);
        assertThat(conditionalBlock.getBodyObjects().size(), is(3));
        assertThat(conditionalBlock.getBodyObjects().get(0).getObjectName(), is("banner-1"));
        assertThat(conditionalBlock.getBodyObjects().get(1).getObjectName(), is("banner-2"));
        assertThat(conditionalBlock.getBodyObjects().get(2).getObjectName(), is("banner-3"));
    }
View Full Code Here

   
   
   
    public StateDoingConditionalBlocks(Properties properties, boolean inverted, String contextPath, PageSpecReader pageSpecReader) {
        setProperties(properties);
        conditionalBlock = new ConditionalBlock();
        conditionalBlock.setStatements(new LinkedList<ConditionalBlockStatement>());
        this.setPageSpecReader(pageSpecReader);
        this.contextPath = contextPath;
        startNewStatement(inverted);
       
View Full Code Here

              }
              else if (firstWord.equals("otherwise")) {
                    stateConditionalBlock.startOtherwise();
                }
              else if (firstWord.equals("end")) {
                  ConditionalBlock conditionalBlock = stateConditionalBlock.build();
                   
                  if (currentSection == null) {
                      startNewSection("");
                  }
                 
View Full Code Here

TOP

Related Classes of net.mindengine.galen.specs.page.ConditionalBlock

Copyright © 2018 www.massapicom. 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.