silverstripe-framework/thirdparty/jquery-entwine/spec/legacy/spec.concrete.properties.js
Ingo Schommer 8256228e69 MINOR Upgraded jQuery.entwine (formerly known as jQuery.concrete) to the latest trunk
MINOR Updated jQuery.concrete references to point to the new "entwine" name

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102695 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-04-13 05:45:29 +00:00

103 lines
2.2 KiB
JavaScript

describe 'Concrete'
describe 'Properties'
before
$('body').append('<div id="dom_test"></div>')
end
after
$('#dom_test').remove()
end
before_each
$.concrete.clear_all_rules()
$('#dom_test').html('<div id="a" class="a b c"></div><div id="b" class="b c"></div>')
end
it 'can define and get a basic property'
$('#a').concrete({
Foo: null
});
$('.a').getFoo().should.be_null
end
it 'can define and set a basic property'
$('#a').concrete({
Foo: null
});
$('.a').setFoo(1);
$('.a').getFoo().should.equal 1
end
it 'can define a default value'
$('#a').concrete({
Foo: 1
});
$('.a').getFoo().should.equal 1
end
it 'should manage proprties in namespaces without clashing'
$('#a').concrete({
Foo: 1
});
$.concrete('test', function($){
$('#a').concrete({
Foo: 2
});
});
$('.a').getFoo().should.equal 1
$('.a').concrete('test').getFoo().should.equal 2
$('.a').setFoo(4);
$('.a').concrete('test').setFoo(8);
$('.a').getFoo().should.equal 4
$('.a').concrete('test').getFoo().should.equal 8
end
it 'should manage directly setting proprties in namespaces without clashing'
$('#a').concrete({
Foo: null
});
$.concrete('test', function($){
$('#a').concrete({
Foo: null
});
});
$('.a').concreteData('Foo', 4);
$('.a').concrete('test').concreteData('Foo', 8);
$('.a').concreteData('Foo').should.equal 4
$('.a').concrete('test').concreteData('Foo').should.equal 8
end
describe 'jQuery style accessors'
it 'can define and get a basic property'
$('#a').concrete({
Foo: null
});
$('.a').Foo().should.be_null
end
it 'can define and set a basic property'
$('#a').concrete({
Foo: null
});
$('.a').Foo(1);
$('.a').Foo().should.equal 1
end
it 'can define a default value'
$('#a').concrete({
Foo: 1
});
$('.a').Foo().should.equal 1
end
end
end
end