metadata_spec.js 1.2 KB

1234567891011121314151617181920212223242526
  1. /* Copyright 2017 Mozilla Foundation
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. 'use strict';
  16. var displayMetadata = require('../../display/metadata.js');
  17. var Metadata = displayMetadata.Metadata;
  18. describe('metadata', function () {
  19. describe('incorrect_xmp', function () {
  20. it('should fix the incorrect XMP data', function () {
  21. var invalidXMP = '<x:xmpmeta xmlns:x=\'adobe:ns:meta/\'>' + '<rdf:RDF xmlns:rdf=\'http://www.w3.org/1999/02/22-rdf-syntax-ns#\'>' + '<rdf:Description xmlns:dc=\'http://purl.org/dc/elements/1.1/\'>' + '<dc:title>\\376\\377\\000P\\000D\\000F\\000&</dc:title>' + '</rdf:Description></rdf:RDF></x:xmpmeta>';
  22. var meta = new Metadata(invalidXMP);
  23. expect(meta.get('dc:title')).toEqual('PDF&');
  24. });
  25. });
  26. });