This repository has been archived on 2025-01-19. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
$this->assertIdentical($list_items,$expected_list_items,'The list items have the correct attributes that will allow the drupal.active-link library to mark them as active.');
$this->assertIdentical($anchors,$expected_anchors,'The anchors have the correct attributes that will allow the drupal.active-link library to mark them as active.');
$settings=$this->getDrupalSettings();
$this->assertIdentical($settings['path']['currentPath'],'user/2','drupalSettings.path.currentPath is set correctly to allow drupal.active-link to mark the correct links as active.');
$this->assertIdentical($settings['path']['isFront'],FALSE,'drupalSettings.path.isFront is set correctly to allow drupal.active-link to mark the correct links as active.');
$this->assertIdentical($settings['path']['currentLanguage'],'en','drupalSettings.path.currentLanguage is set correctly to allow drupal.active-link to mark the correct links as active.');
$this->assertIdentical($labels,array('English','français'),'The language links labels are in their own language on the language switcher block.');
$this->assertIdentical($links,array('active'=>array('en'),'inactive'=>array('fr')),'Only the current language list item is marked as active on the language switcher block.');
$this->assertIdentical($anchors,array('active'=>array('en'),'inactive'=>array('fr')),'Only the current language anchor is marked as active on the language switcher block.');
$this->assertIdentical($labels,array('English','français'),'The language links labels are in their own language on the language switcher block.');
$links=$this->xpath('//a[@id = :id and @data-drupal-link-system-path = :path]',array(':id'=>'no_lang_link',':path'=>$path));
$this->assertTrue(isset($links[0]),t('A link generated by :function to the current :language page with langcode :langcode has the correct attributes that will allow the drupal.active-link library to mark it as active.',array(':function'=>$function_name,':language'=>$current_language,':langcode'=>$langcode)));
// Language code 'en' link should be active.
$langcode='en';
$links=$this->xpath('//a[@id = :id and @hreflang = :lang and @data-drupal-link-system-path = :path]',array(':id'=>'en_link',':lang'=>'en',':path'=>$path));
$this->assertTrue(isset($links[0]),t('A link generated by :function to the current :language page with langcode :langcode has the correct attributes that will allow the drupal.active-link library to mark it as active.',array(':function'=>$function_name,':language'=>$current_language,':langcode'=>$langcode)));
// Language code 'fr' link should not be active.
$langcode='fr';
$links=$this->xpath('//a[@id = :id and @hreflang = :lang and @data-drupal-link-system-path = :path]',array(':id'=>'fr_link',':lang'=>'fr',':path'=>$path));
$this->assertTrue(isset($links[0]),t('A link generated by :function to the current :language page with langcode :langcode has the correct attributes that will allow the drupal.active-link library to NOT mark it as active.',array(':function'=>$function_name,':language'=>$current_language,':langcode'=>$langcode)));
// Verify that drupalSettings contains the correct values.
$settings=$this->getDrupalSettings();
$this->assertIdentical($settings['path']['currentPath'],$path,'drupalSettings.path.currentPath is set correctly to allow drupal.active-link to mark the correct links as active.');
$this->assertIdentical($settings['path']['isFront'],FALSE,'drupalSettings.path.isFront is set correctly to allow drupal.active-link to mark the correct links as active.');
$this->assertIdentical($settings['path']['currentLanguage'],'en','drupalSettings.path.currentLanguage is set correctly to allow drupal.active-link to mark the correct links as active.');
$links=$this->xpath('//a[@id = :id and @data-drupal-link-system-path = :path]',array(':id'=>'no_lang_link',':path'=>$path));
$this->assertTrue(isset($links[0]),t('A link generated by :function to the current :language page with langcode :langcode has the correct attributes that will allow the drupal.active-link library to mark it as active.',array(':function'=>$function_name,':language'=>$current_language,':langcode'=>$langcode)));
// Language code 'en' link should not be active.
$langcode='en';
$links=$this->xpath('//a[@id = :id and @hreflang = :lang and @data-drupal-link-system-path = :path]',array(':id'=>'en_link',':lang'=>'en',':path'=>$path));
$this->assertTrue(isset($links[0]),t('A link generated by :function to the current :language page with langcode :langcode has the correct attributes that will allow the drupal.active-link library to NOT mark it as active.',array(':function'=>$function_name,':language'=>$current_language,':langcode'=>$langcode)));
// Language code 'fr' link should be active.
$langcode='fr';
$links=$this->xpath('//a[@id = :id and @hreflang = :lang and @data-drupal-link-system-path = :path]',array(':id'=>'fr_link',':lang'=>'fr',':path'=>$path));
$this->assertTrue(isset($links[0]),t('A link generated by :function to the current :language page with langcode :langcode has the correct attributes that will allow the drupal.active-link library to mark it as active.',array(':function'=>$function_name,':language'=>$current_language,':langcode'=>$langcode)));
// Verify that drupalSettings contains the correct values.
$settings=$this->getDrupalSettings();
$this->assertIdentical($settings['path']['currentPath'],$path,'drupalSettings.path.currentPath is set correctly to allow drupal.active-link to mark the correct links as active.');
$this->assertIdentical($settings['path']['isFront'],FALSE,'drupalSettings.path.isFront is set correctly to allow drupal.active-link to mark the correct links as active.');
$this->assertIdentical($settings['path']['currentLanguage'],'fr','drupalSettings.path.currentLanguage is set correctly to allow drupal.active-link to mark the correct links as active.');
$links=$this->xpath('//a[@id = :id and contains(@class, :class)]',array(':id'=>'no_lang_link',':class'=>'is-active'));
$this->assertTrue(isset($links[0]),t('A link generated by :function to the current :language page with langcode :langcode is marked active.',array(':function'=>$function_name,':language'=>$current_language,':langcode'=>$langcode)));
// Language code 'en' link should be active.
$langcode='en';
$links=$this->xpath('//a[@id = :id and contains(@class, :class)]',array(':id'=>'en_link',':class'=>'is-active'));
$this->assertTrue(isset($links[0]),t('A link generated by :function to the current :language page with langcode :langcode is marked active.',array(':function'=>$function_name,':language'=>$current_language,':langcode'=>$langcode)));
// Language code 'fr' link should not be active.
$langcode='fr';
$links=$this->xpath('//a[@id = :id and not(contains(@class, :class))]',array(':id'=>'fr_link',':class'=>'is-active'));
$this->assertTrue(isset($links[0]),t('A link generated by :function to the current :language page with langcode :langcode is NOT marked active.',array(':function'=>$function_name,':language'=>$current_language,':langcode'=>$langcode)));
$links=$this->xpath('//a[@id = :id and contains(@class, :class)]',array(':id'=>'no_lang_link',':class'=>'is-active'));
$this->assertTrue(isset($links[0]),t('A link generated by :function to the current :language page with langcode :langcode is marked active.',array(':function'=>$function_name,':language'=>$current_language,':langcode'=>$langcode)));
// Language code 'en' link should not be active.
$langcode='en';
$links=$this->xpath('//a[@id = :id and not(contains(@class, :class))]',array(':id'=>'en_link',':class'=>'is-active'));
$this->assertTrue(isset($links[0]),t('A link generated by :function to the current :language page with langcode :langcode is NOT marked active.',array(':function'=>$function_name,':language'=>$current_language,':langcode'=>$langcode)));
// Language code 'fr' link should be active.
$langcode='fr';
$links=$this->xpath('//a[@id = :id and contains(@class, :class)]',array(':id'=>'fr_link',':class'=>'is-active'));
$this->assertTrue(isset($links[0]),t('A link generated by :function to the current :language page with langcode :langcode is marked active.',array(':function'=>$function_name,':language'=>$current_language,':langcode'=>$langcode)));