Permalink
Browse files

Merge pull request #144 from skurfuerst/master

[BUGFIX] make type loading order independent
  • Loading branch information...
2 parents 9eaa321 + 52c4da4 commit e981d35c8f1f44d58501c5f9933b75afc40ee171 @bergie committed Nov 29, 2012
Showing with 43 additions and 2 deletions.
  1. +1 −1 src/Util.js
  2. +42 −1 test/core/schema.js
View
@@ -509,7 +509,7 @@ VIE.Util = {
for (var i = 0; i < ancestors.length; i++) {
var supertype = (vie.types.get(ancestors[i]))? vie.types.get(ancestors[i]) :
- typeHelper.call(vie, SchemaOrg.types[ancestors[i]].supertypes, ancestors[i], typeProps.call(vie, ancestors[i]));
+ typeHelper.call(vie, SchemaOrg.types[ancestors[i]].supertypes, ancestors[i], typeProps.call(vie, ancestors[i]), metadataHelper(SchemaOrg.types[ancestors[i]]));
type.inherit(supertype);
}
if (id === "Thing" && !type.isof("owl:Thing")) {
View
@@ -69,5 +69,46 @@ test("Initialization", function() {
start();
}
});
-
+
});
+
+test("Hierarchy Metadata", function() {
+ var z = new VIE();
+ z.namespaces.addOrReplace('typo3', 'http://typo3.org/ns');
+
+ ok(z.loadSchema);
+ equal(typeof z.loadSchema, "function");
+
+ VIE.Util.loadSchemaOrg(z, {
+ properties: {},
+ types: {
+ 'typo3:Foo.Bar': {
+ id: 'typo3:Foo.Bar',
+ metadata: {
+ group: 'Test',
+ other: 'Foo'
+ },
+ supertypes: ['typo3:Other'],
+ subtypes: [],
+ specific_properties: [],
+ properties: []
+ },
+ 'typo3:Other': {
+ id: 'typo3:Other',
+ metadata: {
+ some: 'thing',
+ prop2: 'val2'
+ },
+ subtypes: ['typo3:Foo.Bar'],
+ supertypes: [],
+ specific_properties: [],
+ properties: []
+ }
+ }
+ }, null);
+
+ equal(z.types.get('typo3:Foo.Bar').metadata.group, 'Test');
+ equal(z.types.get('typo3:Foo.Bar').metadata.other, 'Foo');
+ equal(z.types.get('typo3:Other').metadata.some, 'thing');
+ equal(z.types.get('typo3:Other').metadata.prop2, 'val2');
+});

0 comments on commit e981d35

Please sign in to comment.