Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,970 changes: 985 additions & 985 deletions src/Devablo.Training.Frontend.ES6/package-lock.json

Large diffs are not rendered by default.

This file was deleted.

5 changes: 2 additions & 3 deletions src/Devablo.Training.Frontend.ES6/tests/basics.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ test('test conditional operator using Flag False and expect 0', () => {
expect(testFunc(false)).toBe(0);
});

test('', () => {

test('test Object Is', () => {
let result = Object.is(1,2);

expect(result).toBe(false);
});
});
7 changes: 6 additions & 1 deletion src/Devablo.Training.Frontend.ES6/tests/deconstruction.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// MDN - Destructuring assignment
/*
The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables.
*/

// Testing Deconstruction
test('can deconstruct arrays', () => {
let [x, y] = [3,2];
Expand Down Expand Up @@ -31,7 +36,7 @@ test('can deconstruct objects', () => {
expect(lastName).toBe("Morey");
});

test('can deconstruct objects with functions', () => {
test('can deconstruct objects with functions to new variable names', () => {

let getObject = function() {
return {
Expand Down
18 changes: 18 additions & 0 deletions src/Devablo.Training.Frontend.ES6/tests/functions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,24 @@ test('can get rest params arguments from function', () => {


// Arrow Functions

test('can execute arrow functions using parentheses', () => {
const arr = [1, 2, 3];
const squares = arr.map((x) => x * x);

console.log(squares);
expect(squares).not.toBeNull();
});


test('can execute arrow functions with single param without parentheses', () => {
const arr = [1, 2, 3];
const squares = arr.map(x => x * x);

console.log(squares);
expect(squares).toEqual([1,4,9]);
});

test('can execute arrow function basic', () => {
let sum = (x,y) => x + y;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,17 @@ test('test Let Scoping using Flag True and expect value', () => {
test('test Let Scoping using Flag False and undefined', () => {
// Need to have wrapper for testing ThrowError
expect(() => {testLetfunc(false)}).toThrowError(ReferenceError);
});
});


test('test IIFE scoping', () => {

func = () => {
(function () { // open IIFE
var tmp = "Hello World";
}()); // close IIFE
}

// Need to have wrapper for testing ThrowError
expect(() => {tmp}).toThrowError(ReferenceError);
});
25 changes: 25 additions & 0 deletions src/Devablo.Training.Frontend.ES6/tests/string-literals.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// string literals
test('can use template literal', () => {
let doWork = function(name) {
return `Hello ${name}`;
};

let result = doWork("Aaron");

expect(result).toBe("Hello Aaron");
})

test('can use template literal spanning multiple lines', () => {
const html = `
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
</body>
</html>`;

expect(html).not.toBeNull();
})