View file modules/syntaxhighlighter/tests/cases/010_highlight.html

File size: 1.85Kb
<pre id="sh_010_highlight_a" class="brush: groovy; highlight: 2">
	public function validateStrongPassword(password:String):Boolean
	{
		if (password == null || password.length <= 0)
		{
			return false;
		}
		
		return STRONG_PASSWORD_PATTERN.test(password);
	}
</pre>
<script id="sh_010_highlight_b" type="syntaxhighlighter" class="brush: as3; highlight: [2, 4, 12]"><![CDATA[
	/**
	 * Checks a password and returns a value indicating whether the password is a "strong" 
	 * password. The criteria for a strong password are:
	 * 
	 * <ul>
	 *   <li>Minimum 8 characters</li>
	 *   <li>Maxmium 32 characters</li>
	 *   <li>Contains at least one lowercase letter</li>
	 *   <li>Contains at least one uppercase letter</li>
	 *   <li>Contains at least one number or symbol character</li>
	 * </ul>
	 * 
	 * @param password The password to check
	 * 
	 * @return A value indicating whether the password is a strong password (<code>true</code>) 
	 * or not (<code>false</code>).
	 */
	public function validateStrongPassword(password:String):Boolean
	{
		if (password == null || password.length <= 0)
		{
			return false;
		}
		
		return STRONG_PASSWORD_PATTERN.test(password);
	}
]]></script>

<script type="text/javascript">
queue(function()
{
	var $sh;
	
	module('010_highlight');
	
	test('one highlighted line', function() 
	{
		$sh = $('#sh_010_highlight_a');
		
		ok_sh($sh);
		ok_toolbar($sh);
		ok_code($sh);
		ok($sh.find('.gutter .number2').is('.highlighted'), 'Line 2 is highlighted');
	});

	test('multiple highlighted lines', function() 
	{
		$sh = $('#sh_010_highlight_b');
		
		ok_sh($sh);
		ok_toolbar($sh);
		ok_code($sh);
		ok($sh.find('.gutter .number2').is('.highlighted'), 'Line 2 is highlighted');
		ok($sh.find('.gutter .number4').is('.highlighted'), 'Line 4 is highlighted');
		ok($sh.find('.gutter .number12').is('.highlighted'), 'Line 12 is highlighted');
	});
});
</script>