File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,8 @@ export class Literal implements RDF.Literal {
4949
5050 public equals ( other ?: RDF . Term | null ) : boolean {
5151 return ! ! other && other . termType === 'Literal' && other . value === this . value &&
52- other . language === this . language && other . direction === this . direction &&
52+ other . language === this . language &&
53+ ( ( other . direction === this . direction ) || ( ! other . direction && this . direction === '' ) ) &&
5354 this . datatype . equals ( other . datatype ) ;
5455 }
5556}
Original file line number Diff line number Diff line change @@ -138,6 +138,11 @@ describe('DataFactory', () => {
138138
139139 expect ( factory . literal ( 'a' , { language : 'en-us' , direction : 'ltr' } )
140140 . equals ( factory . literal ( 'a' , { language : 'en-us' , direction : 'ltr' } ) ) ) . toEqual ( true ) ;
141+ // Simulate old data factory before base direction existed
142+ const literalNullDirection = factory . literal ( 'a' , 'en-us' ) ;
143+ ( < any > literalNullDirection ) . direction = undefined ;
144+ expect ( factory . literal ( 'a' , { language : 'en-us' , direction : '' } )
145+ . equals ( literalNullDirection ) ) . toEqual ( true ) ;
141146
142147 expect ( factory . literal ( 'a' )
143148 . equals ( factory . literal ( 'a' , 'en-us' ) ) ) . toEqual ( false ) ;
You can’t perform that action at this time.
0 commit comments