Dieses Repository beinhaltet HTML- und Javascript Code zur einer NotizenWebApp auf Basis von Web Storage. Zudem sind Mocha/Chai Tests im Browser enthalten. https://meinenotizen.netlify.app/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

native.js 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. 'use strict';
  2. var test = require('tape');
  3. var defineProperties = require('define-properties');
  4. var isEnumerable = Object.prototype.propertyIsEnumerable;
  5. var functionsHaveNames = function f() {}.name === 'f';
  6. var runTests = require('./tests');
  7. test('native', function (t) {
  8. t.equal(Object.assign.length, 2, 'Object.assign has a length of 2');
  9. t.test('Function name', { skip: !functionsHaveNames }, function (st) {
  10. st.equal(Object.assign.name, 'assign', 'Object.assign has name "assign"');
  11. st.end();
  12. });
  13. t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
  14. et.equal(false, isEnumerable.call(Object, 'assign'), 'Object.assign is not enumerable');
  15. et.end();
  16. });
  17. var supportsStrictMode = (function () { return typeof this === 'undefined'; }());
  18. t.test('bad object value', { skip: !supportsStrictMode }, function (st) {
  19. st['throws'](function () { return Object.assign(undefined); }, TypeError, 'undefined is not an object');
  20. st['throws'](function () { return Object.assign(null); }, TypeError, 'null is not an object');
  21. st.end();
  22. });
  23. // v8 in node 0.8 and 0.10 have non-enumerable string properties
  24. var stringCharsAreEnumerable = isEnumerable.call('xy', 0);
  25. t.test('when Object.assign is present and has pending exceptions', { skip: !stringCharsAreEnumerable || !Object.preventExtensions }, function (st) {
  26. // Firefox 37 still has "pending exception" logic in its Object.assign implementation,
  27. // which is 72% slower than our shim, and Firefox 40's native implementation.
  28. var thrower = Object.preventExtensions({ 1: '2' });
  29. var error;
  30. try { Object.assign(thrower, 'xy'); } catch (e) { error = e; }
  31. st.equal(error instanceof TypeError, true, 'error is TypeError');
  32. st.equal(thrower[1], '2', 'thrower[1] === "2"');
  33. st.end();
  34. });
  35. runTests(Object.assign, t);
  36. t.end();
  37. });