git-svn-id: http://svn.openlayers.org/trunk/openlayers@6131 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
42 lines
1.2 KiB
HTML
42 lines
1.2 KiB
HTML
<html>
|
|
<head>
|
|
<script src="../../lib/OpenLayers.js"></script>
|
|
<script type="text/javascript">
|
|
|
|
function test_Logical_constructor(t) {
|
|
t.plan(3);
|
|
|
|
var options = {'foo': 'bar'};
|
|
var rule = new OpenLayers.Rule.Logical(options);
|
|
t.ok(rule instanceof OpenLayers.Rule.Logical,
|
|
"new OpenLayers.Rule.Logical returns object" );
|
|
t.eq(rule.foo, "bar", "constructor sets options correctly");
|
|
t.eq(typeof rule.evaluate, "function", "rule has an evaluate function");
|
|
}
|
|
|
|
function test_Logical_destroy(t) {
|
|
t.plan(1);
|
|
|
|
var rule = new OpenLayers.Rule.Logical();
|
|
rule.destroy();
|
|
t.eq(rule.rules, null, "rules array nulled properly");
|
|
}
|
|
|
|
function test_Logical_evaluate(t) {
|
|
t.plan(1);
|
|
|
|
var rule = new OpenLayers.Rule.Logical({
|
|
type: OpenLayers.Rule.Logical.NOT});
|
|
rule.rules.push(new OpenLayers.Rule());
|
|
|
|
var feature = new OpenLayers.Feature.Vector();
|
|
|
|
t.eq(rule.evaluate(feature), false,
|
|
"feature evaluates to false correctly.");
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
</body>
|
|
</html>
|