Package org.jsoup.nodes

Examples of org.jsoup.nodes.Attributes


 
  @Test
  public void dontDetectNonDojoScript() {
    LocalWebPage localWebPage = new LocalWebPage("");
   
    Attributes attrs = new Attributes();
    attrs.put("src", "another_script.js");   
   
    Element dojoScript = new Element(Tag.valueOf("script"), "", attrs);
   
    assertFalse(localWebPage.isDojoScript(dojoScript));
  }
View Full Code Here


  @Test
  public void defaultsToNonAmdScriptModeWithoutConfig() throws IOException {
    MockWebPage webPage = new MockWebPage();
    webPage.isDojoScript = true;
   
    Attributes attrs = new Attributes();   
    Element dojoScript = new Element(Tag.valueOf("script"), "", attrs);

    webPage.parsePreDojoScript(dojoScript);
    assertEquals(Collections.EMPTY_MAP, webPage.modulePaths);
  }
View Full Code Here

  @Test
  public void parsesPathsValueFromConfigAttrOnScriptTag() throws IOException {
    MockWebPage webPage = new MockWebPage();
    webPage.isDojoScript = true;
   
    Attributes attrs = new Attributes();
    attrs.put("data-dojo-config", "paths: {'some': 'path', 'an': 'other'}");   
   
    Element dojoScript = new Element(Tag.valueOf("script"), "", attrs);
    webPage.parsePreDojoScript(dojoScript);
    assertEquals(LoaderConfigParserTest.getPrepopulatedMap("some", "path", "an", "other"), webPage.modulePaths);
  }
View Full Code Here

  @Test
  public void parsesPathsValueFromPackagesConfigAttrOnScriptTag() throws IOException {
    MockWebPage webPage = new MockWebPage();
    webPage.isDojoScript = true;
   
    Attributes attrs = new Attributes();
    attrs.put("data-dojo-config", "'packages': [{'name': 'some', 'location': 'path'}, {'name': 'an', 'location':'other'}]");   
   
    Element dojoScript = new Element(Tag.valueOf("script"), "", attrs);
    webPage.parsePreDojoScript(dojoScript);
    assertEquals(LoaderConfigParserTest.getPrepopulatedMap("some", "path", "an", "other"), webPage.modulePaths);
  }
View Full Code Here

  @Test
  public void parsesPathsValueFromOldConfigAttrOnScriptTag() throws IOException {
    MockWebPage webPage = new MockWebPage();
    webPage.isDojoScript = true;
   
    Attributes attrs = new Attributes();
    attrs.put("djConfig", "paths: {'some': 'path', 'an': 'other'}");   
   
    Element dojoScript = new Element(Tag.valueOf("script"), "", attrs);
    webPage.parsePreDojoScript(dojoScript);
    assertEquals(LoaderConfigParserTest.getPrepopulatedMap("some", "path", "an", "other"), webPage.modulePaths);
  }
View Full Code Here

  @Test
  public void parsesPathsValueFromConfigDeclarationInScriptTag() throws IOException {
    MockWebPage webPage = new MockWebPage();
    webPage.scriptContents = "var dojoConfig = { paths: {'some': 'path', 'an': 'other'} }";
   
    Attributes attrs = new Attributes();     
    Element dojoScript = new Element(Tag.valueOf("script"), "", attrs);
   
    webPage.parsePreDojoScript(dojoScript);
    assertEquals(LoaderConfigParserTest.getPrepopulatedMap("some", "path", "an", "other"), webPage.modulePaths);
 
View Full Code Here

  @Test
  public void parsesPathsValueFromOldConfigDeclarationInScriptTag() throws IOException {
    MockWebPage webPage = new MockWebPage();
    webPage.scriptContents = "var djConfig = { paths: {'some': 'path', 'an': 'other'} }";
   
    Attributes attrs = new Attributes();     
    Element dojoScript = new Element(Tag.valueOf("script"), "", attrs);
   
    webPage.parsePreDojoScript(dojoScript);
    assertEquals(LoaderConfigParserTest.getPrepopulatedMap("some", "path", "an", "other"), webPage.modulePaths);
 
View Full Code Here

  @Test
  public void parsesMultiplePathsValuesFromConfigsScripts() throws IOException {
    MockWebPage webPage = new MockWebPage();   
    webPage.scriptContents = "var djConfig = { paths: {'some': 'path', 'an': 'other'} }";
 
    Attributes attrs = new Attributes();     
    Element dojoScript = new Element(Tag.valueOf("script"), "", attrs);
   
    webPage.parsePreDojoScript(dojoScript);
   
    webPage.isDojoScript = true;

    attrs.put("data-dojo-config", "paths: {'more': 'paths'}")
   
    webPage.parsePreDojoScript(dojoScript);
   
    assertEquals(LoaderConfigParserTest.getPrepopulatedMap("some", "path", "an", "other", "more", "paths"), webPage.modulePaths);
  }
View Full Code Here

  @Test
  public void parsesPathsWithCorrectPrecedence() throws IOException {
    MockWebPage webPage = new MockWebPage();   
    webPage.scriptContents = "var djConfig = { paths: {'some': 'path', 'an': 'other'} }";
 
    Attributes attrs = new Attributes();     
    Element dojoScript = new Element(Tag.valueOf("script"), "", attrs);
   
    webPage.parsePreDojoScript(dojoScript);
   
    webPage.isDojoScript = true;

    attrs.put("data-dojo-config", "paths: {'some': 'override'}")
   
    webPage.parsePreDojoScript(dojoScript);
   
    assertEquals(LoaderConfigParserTest.getPrepopulatedMap("some", "override", "an", "other"), webPage.modulePaths);
 
View Full Code Here

  @Test
  public void defaultsToNonAmdScriptModeWithoutConfig() {
    MockWebPage webPage = new MockWebPage();
    webPage.isDojoScript = true;
   
    Attributes attrs = new Attributes();   
    Element dojoScript = new Element(Tag.valueOf("script"), "", attrs);
   
    assertEquals(ModuleFormat.NON_AMD, webPage.moduleFormat);
    webPage.parsePreDojoScript(dojoScript);
    assertEquals(ModuleFormat.NON_AMD, webPage.moduleFormat);
View Full Code Here

TOP

Related Classes of org.jsoup.nodes.Attributes

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.