content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
PHP
PHP
allow options per hasher class for fallback
04ab8838e4915ffd95b6e11eae3ebdc14be93119
<ide><path>src/Auth/FallbackPasswordHasher.php <ide> class FallbackPasswordHasher extends AbstractPasswordHasher { <ide> */ <ide> public function __construct(array $config = array()) { <ide> parent::__construct($config); <del> foreach ($this->_config['hashers'] as $hasher) { <add> foreach ($this->_config['hashers'] as $key => $hasher) { <add> if (!is_int($key)) { <add> $hasher += [ <add> 'className' => $key, <add> ]; <add> } <ide> $this->_hashers[] = PasswordHasherFactory::build($hasher); <ide> } <ide> } <ide><path>tests/TestCase/Auth/FallbackPasswordHasherTest.php <ide> public function testCheck() { <ide> $this->assertTrue($hasher->check('foo', $otherHash)); <ide> } <ide> <add>/** <add> * Tests that the check method will work with configured hashers including configs <add> * per hasher. <add> * <add> * @return void <add> */ <add> public function testCheckWithConfigs() { <add> $hasher = new FallbackPasswordHasher(['hashers' => ['Default', 'Weak' => ['hashType' => 'md5']]]); <add> $legacy = new WeakPasswordHasher(['hashType' => 'md5']); <add> $simple = new DefaultPasswordHasher(); <add> <add> $hash = $simple->hash('foo'); <add> $legacyHash = $legacy->hash('foo'); <add> $this->assertTrue($hash !== $legacyHash); <add> $this->assertTrue($hasher->check('foo', $hash)); <add> $this->assertTrue($hasher->check('foo', $legacyHash)); <add> } <add> <ide> /** <ide> * Tests that the password only needs to be re-built according to the first hasher <ide> *
2
Javascript
Javascript
fix long lines in vendor/fbtransform/visitors
362e9595c46c0a2079cd7bfbdbb93f8ea7b2f5f7
<ide><path>vendor/fbtransform/visitors.js <ide> <ide> 'use strict'; <ide> <del>var es6ArrowFunctions = require('jstransform/visitors/es6-arrow-function-visitors'); <add>var es6ArrowFunctions = <add> require('jstransform/visitors/es6-arrow-function-visitors'); <ide> var es6Classes = require('jstransform/visitors/es6-class-visitors'); <del>var es6Destructuring = require('jstransform/visitors/es6-destructuring-visitors'); <del>var es6ObjectConciseMethod = require('jstransform/visitors/es6-object-concise-method-visitors'); <del>var es6ObjectShortNotation = require('jstransform/visitors/es6-object-short-notation-visitors'); <add>var es6Destructuring = <add> require('jstransform/visitors/es6-destructuring-visitors'); <add>var es6ObjectConciseMethod = <add> require('jstransform/visitors/es6-object-concise-method-visitors'); <add>var es6ObjectShortNotation = <add> require('jstransform/visitors/es6-object-short-notation-visitors'); <ide> var es6RestParameters = require('jstransform/visitors/es6-rest-param-visitors'); <ide> var es6Templates = require('jstransform/visitors/es6-template-visitors'); <del>var es7SpreadProperty = require('jstransform/visitors/es7-spread-property-visitors'); <add>var es7SpreadProperty = <add> require('jstransform/visitors/es7-spread-property-visitors'); <ide> var react = require('./transforms/react'); <ide> var reactDisplayName = require('./transforms/reactDisplayName'); <ide>
1
Javascript
Javascript
add skinnedmesh check for .bones animation path
9f2d1aea97ece8143e8d576ca72854a0c51a3057
<ide><path>examples/js/exporters/GLTFExporter.js <ide> THREE.GLTFExporter.prototype = { <ide> var trackNode = THREE.PropertyBinding.findNode( root, trackBinding.nodeName ); <ide> var trackProperty = PATH_PROPERTIES[ trackBinding.propertyName ]; <ide> <del> if ( trackBinding.objectName === 'bones' && trackNode.isSkinnedMesh === true ) { <add> if ( trackBinding.objectName === 'bones' ) { <ide> <del> trackNode = trackNode.skeleton.getBoneByName( trackBinding.objectIndex ); <add> if ( trackNode.isSkinnedMesh === true ) { <add> <add> trackNode = trackNode.skeleton.getBoneByName( trackBinding.objectIndex ); <add> <add> } else { <add> <add> trackNode = undefined; <add> <add> } <ide> <ide> } <ide>
1
Python
Python
use example.com domain in tests.
a1b35bb44b7c9251c8b7bc995aa6598044f1d3ef
<ide><path>tests/schemas/test_managementcommand.py <ide> def test_command_detects_schema_generation_mode(self): <ide> @pytest.mark.skipif(yaml is None, reason='PyYAML is required.') <ide> def test_renders_default_schema_with_custom_title_url_and_description(self): <ide> call_command('generateschema', <del> '--title=SampleAPI', <del> '--url=http://api.sample.com', <del> '--description=Sample description', <add> '--title=ExampleAPI', <add> '--url=http://api.example.com', <add> '--description=Example description', <ide> stdout=self.out) <ide> # Check valid YAML was output. <ide> schema = yaml.safe_load(self.out.getvalue()) <ide> def test_writes_schema_to_file_on_parameter(self): <ide> @override_settings(REST_FRAMEWORK={'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.AutoSchema'}) <ide> def test_coreapi_renders_default_schema_with_custom_title_url_and_description(self): <ide> expected_out = """info: <del> description: Sample description <del> title: SampleAPI <add> description: Example description <add> title: ExampleAPI <ide> version: '' <ide> openapi: 3.0.0 <ide> paths: <ide> /: <ide> get: <ide> operationId: list <ide> servers: <del> - url: http://api.sample.com/ <add> - url: http://api.example.com/ <ide> """ <ide> call_command('generateschema', <del> '--title=SampleAPI', <del> '--url=http://api.sample.com', <del> '--description=Sample description', <add> '--title=ExampleAPI', <add> '--url=http://api.example.com', <add> '--description=Example description', <ide> stdout=self.out) <ide> <ide> self.assertIn(formatting.dedent(expected_out), self.out.getvalue())
1
Python
Python
remove old, outdated files in /bin
5025d709e08a7755e20b9a13b8b22f83c37b9273
<ide><path>bin/get_freqs.py <del>#!/usr/bin/env python <del> <del>from __future__ import unicode_literals, print_function <del> <del>import plac <del>import joblib <del>from os import path <del>import os <del>import bz2 <del>import ujson <del>from preshed.counter import PreshCounter <del>from joblib import Parallel, delayed <del>import io <del> <del>from spacy.en import English <del>from spacy.strings import StringStore <del>from spacy.attrs import ORTH <del>from spacy.tokenizer import Tokenizer <del>from spacy.vocab import Vocab <del> <del> <del>def iter_comments(loc): <del> with bz2.BZ2File(loc) as file_: <del> for line in file_: <del> yield ujson.loads(line) <del> <del> <del>def count_freqs(input_loc, output_loc): <del> print(output_loc) <del> vocab = English.default_vocab(get_lex_attr=None) <del> tokenizer = Tokenizer.from_dir(vocab, <del> path.join(English.default_data_dir(), 'tokenizer')) <del> <del> counts = PreshCounter() <del> for json_comment in iter_comments(input_loc): <del> doc = tokenizer(json_comment['body']) <del> doc.count_by(ORTH, counts=counts) <del> <del> with io.open(output_loc, 'w', 'utf8') as file_: <del> for orth, freq in counts: <del> string = tokenizer.vocab.strings[orth] <del> if not string.isspace(): <del> file_.write('%d\t%s\n' % (freq, string)) <del> <del> <del>def parallelize(func, iterator, n_jobs): <del> Parallel(n_jobs=n_jobs)(delayed(func)(*item) for item in iterator) <del> <del> <del>def merge_counts(locs, out_loc): <del> string_map = StringStore() <del> counts = PreshCounter() <del> for loc in locs: <del> with io.open(loc, 'r', encoding='utf8') as file_: <del> for line in file_: <del> freq, word = line.strip().split('\t', 1) <del> orth = string_map[word] <del> counts.inc(orth, int(freq)) <del> with io.open(out_loc, 'w', encoding='utf8') as file_: <del> for orth, count in counts: <del> string = string_map[orth] <del> file_.write('%d\t%s\n' % (count, string)) <del> <del> <del>@plac.annotations( <del> input_loc=("Location of input file list"), <del> freqs_dir=("Directory for frequency files"), <del> output_loc=("Location for output file"), <del> n_jobs=("Number of workers", "option", "n", int), <del> skip_existing=("Skip inputs where an output file exists", "flag", "s", bool), <del>) <del>def main(input_loc, freqs_dir, output_loc, n_jobs=2, skip_existing=False): <del> tasks = [] <del> outputs = [] <del> for input_path in open(input_loc): <del> input_path = input_path.strip() <del> if not input_path: <del> continue <del> filename = input_path.split('/')[-1] <del> output_path = path.join(freqs_dir, filename.replace('bz2', 'freq')) <del> outputs.append(output_path) <del> if not path.exists(output_path) or not skip_existing: <del> tasks.append((input_path, output_path)) <del> <del> if tasks: <del> parallelize(count_freqs, tasks, n_jobs) <del> <del> print("Merge") <del> merge_counts(outputs, output_loc) <del> <del> <del>if __name__ == '__main__': <del> plac.call(main) <ide><path>bin/munge_ewtb.py <del>#!/usr/bin/env python <del>from __future__ import unicode_literals <del> <del>from xml.etree import cElementTree as ElementTree <del>import json <del>import re <del> <del>import plac <del>from pathlib import Path <del>from os import path <del> <del> <del>escaped_tokens = { <del> '-LRB-': '(', <del> '-RRB-': ')', <del> '-LSB-': '[', <del> '-RSB-': ']', <del> '-LCB-': '{', <del> '-RCB-': '}', <del>} <del> <del>def read_parses(parse_loc): <del> offset = 0 <del> doc = [] <del> for parse in open(str(parse_loc) + '.dep').read().strip().split('\n\n'): <del> parse = _adjust_token_ids(parse, offset) <del> offset += len(parse.split('\n')) <del> doc.append(parse) <del> return doc <del> <del>def _adjust_token_ids(parse, offset): <del> output = [] <del> for line in parse.split('\n'): <del> pieces = line.split() <del> pieces[0] = str(int(pieces[0]) + offset) <del> pieces[5] = str(int(pieces[5]) + offset) if pieces[5] != '0' else '0' <del> output.append('\t'.join(pieces)) <del> return '\n'.join(output) <del> <del> <del>def _fmt_doc(filename, paras): <del> return {'id': filename, 'paragraphs': [_fmt_para(*para) for para in paras]} <del> <del> <del>def _fmt_para(raw, sents): <del> return {'raw': raw, 'sentences': [_fmt_sent(sent) for sent in sents]} <del> <del> <del>def _fmt_sent(sent): <del> return { <del> 'tokens': [_fmt_token(*t.split()) for t in sent.strip().split('\n')], <del> 'brackets': []} <del> <del> <del>def _fmt_token(id_, word, hyph, pos, ner, head, dep, blank1, blank2, blank3): <del> head = int(head) - 1 <del> id_ = int(id_) - 1 <del> head = (head - id_) if head != -1 else 0 <del> return {'id': id_, 'orth': word, 'tag': pos, 'dep': dep, 'head': head} <del> <del> <del>tags_re = re.compile(r'<[\w\?/][^>]+>') <del>def main(out_dir, ewtb_dir='/usr/local/data/eng_web_tbk'): <del> ewtb_dir = Path(ewtb_dir) <del> out_dir = Path(out_dir) <del> if not out_dir.exists(): <del> out_dir.mkdir() <del> for genre_dir in ewtb_dir.joinpath('data').iterdir(): <del> #if 'answers' in str(genre_dir): continue <del> parse_dir = genre_dir.joinpath('penntree') <del> docs = [] <del> for source_loc in genre_dir.joinpath('source').joinpath('source_original').iterdir(): <del> filename = source_loc.parts[-1].replace('.sgm.sgm', '') <del> filename = filename.replace('.xml', '') <del> filename = filename.replace('.txt', '') <del> parse_loc = parse_dir.joinpath(filename + '.xml.tree') <del> parses = read_parses(parse_loc) <del> source = source_loc.open().read().strip() <del> if 'answers' in str(genre_dir): <del> source = tags_re.sub('', source).strip() <del> docs.append(_fmt_doc(filename, [[source, parses]])) <del> <del> out_loc = out_dir.joinpath(genre_dir.parts[-1] + '.json') <del> with open(str(out_loc), 'w') as out_file: <del> out_file.write(json.dumps(docs, indent=4)) <del> <del> <del>if __name__ == '__main__': <del> plac.call(main) <ide><path>bin/ner_tag.py <del>import io <del>import plac <del> <del>from spacy.en import English <del> <del> <del>def main(text_loc): <del> with io.open(text_loc, 'r', encoding='utf8') as file_: <del> text = file_.read() <del> NLU = English() <del> for paragraph in text.split('\n\n'): <del> tokens = NLU(paragraph) <del> <del> ent_starts = {} <del> ent_ends = {} <del> for span in tokens.ents: <del> ent_starts[span.start] = span.label_ <del> ent_ends[span.end] = span.label_ <del> <del> output = [] <del> for token in tokens: <del> if token.i in ent_starts: <del> output.append('<%s>' % ent_starts[token.i]) <del> output.append(token.orth_) <del> if (token.i+1) in ent_ends: <del> output.append('</%s>' % ent_ends[token.i+1]) <del> output.append('\n\n') <del> print ' '.join(output) <del> <del> <del>if __name__ == '__main__': <del> plac.call(main) <ide><path>bin/parser/conll_train.py <del>#!/usr/bin/env python <del>from __future__ import division <del>from __future__ import unicode_literals <del> <del>import os <del>from os import path <del>import shutil <del>import io <del>import random <del>import time <del>import gzip <del> <del>import plac <del>import cProfile <del>import pstats <del> <del>import spacy.util <del>from spacy.en import English <del>from spacy.gold import GoldParse <del> <del>from spacy.syntax.util import Config <del>from spacy.syntax.arc_eager import ArcEager <del>from spacy.syntax.parser import Parser <del>from spacy.scorer import Scorer <del>from spacy.tagger import Tagger <del> <del># Last updated for spaCy v0.97 <del> <del> <del>def read_conll(file_): <del> """Read a standard CoNLL/MALT-style format""" <del> sents = [] <del> for sent_str in file_.read().strip().split('\n\n'): <del> ids = [] <del> words = [] <del> heads = [] <del> labels = [] <del> tags = [] <del> for i, line in enumerate(sent_str.split('\n')): <del> word, pos_string, head_idx, label = _parse_line(line) <del> words.append(word) <del> if head_idx < 0: <del> head_idx = i <del> ids.append(i) <del> heads.append(head_idx) <del> labels.append(label) <del> tags.append(pos_string) <del> text = ' '.join(words) <del> annot = (ids, words, tags, heads, labels, ['O'] * len(ids)) <del> sents.append((None, [(annot, [])])) <del> return sents <del> <del> <del>def _parse_line(line): <del> pieces = line.split() <del> if len(pieces) == 4: <del> word, pos, head_idx, label = pieces <del> head_idx = int(head_idx) <del> elif len(pieces) == 15: <del> id_ = int(pieces[0].split('_')[-1]) <del> word = pieces[1] <del> pos = pieces[4] <del> head_idx = int(pieces[8])-1 <del> label = pieces[10] <del> else: <del> id_ = int(pieces[0].split('_')[-1]) <del> word = pieces[1] <del> pos = pieces[4] <del> head_idx = int(pieces[6])-1 <del> label = pieces[7] <del> if head_idx == 0: <del> label = 'ROOT' <del> return word, pos, head_idx, label <del> <del> <del>def score_model(scorer, nlp, raw_text, annot_tuples, verbose=False): <del> tokens = nlp.tokenizer.tokens_from_list(annot_tuples[1]) <del> nlp.tagger(tokens) <del> nlp.parser(tokens) <del> gold = GoldParse(tokens, annot_tuples, make_projective=False) <del> scorer.score(tokens, gold, verbose=verbose, punct_labels=('--', 'p', 'punct')) <del> <del> <del>def train(Language, gold_tuples, model_dir, n_iter=15, feat_set=u'basic', seed=0, <del> gold_preproc=False, force_gold=False): <del> dep_model_dir = path.join(model_dir, 'deps') <del> pos_model_dir = path.join(model_dir, 'pos') <del> if path.exists(dep_model_dir): <del> shutil.rmtree(dep_model_dir) <del> if path.exists(pos_model_dir): <del> shutil.rmtree(pos_model_dir) <del> os.mkdir(dep_model_dir) <del> os.mkdir(pos_model_dir) <del> <del> Config.write(dep_model_dir, 'config', features=feat_set, seed=seed, <del> labels=ArcEager.get_labels(gold_tuples)) <del> <del> nlp = Language(data_dir=model_dir, tagger=False, parser=False, entity=False) <del> nlp.tagger = Tagger.blank(nlp.vocab, Tagger.default_templates()) <del> nlp.parser = Parser.from_dir(dep_model_dir, nlp.vocab.strings, ArcEager) <del> <del> print("Itn.\tP.Loss\tUAS\tNER F.\tTag %\tToken %") <del> for itn in range(n_iter): <del> scorer = Scorer() <del> loss = 0 <del> for _, sents in gold_tuples: <del> for annot_tuples, _ in sents: <del> if len(annot_tuples[1]) == 1: <del> continue <del> <del> score_model(scorer, nlp, None, annot_tuples, verbose=False) <del> <del> tokens = nlp.tokenizer.tokens_from_list(annot_tuples[1]) <del> nlp.tagger(tokens) <del> gold = GoldParse(tokens, annot_tuples, make_projective=True) <del> if not gold.is_projective: <del> raise Exception( <del> "Non-projective sentence in training, after we should " <del> "have enforced projectivity: %s" % annot_tuples <del> ) <del> <del> loss += nlp.parser.train(tokens, gold) <del> nlp.tagger.train(tokens, gold.tags) <del> random.shuffle(gold_tuples) <del> print('%d:\t%d\t%.3f\t%.3f\t%.3f' % (itn, loss, scorer.uas, <del> scorer.tags_acc, scorer.token_acc)) <del> print('end training') <del> nlp.end_training(model_dir) <del> print('done') <del> <del> <del>@plac.annotations( <del> train_loc=("Location of CoNLL 09 formatted training file"), <del> dev_loc=("Location of CoNLL 09 formatted development file"), <del> model_dir=("Location of output model directory"), <del> eval_only=("Skip training, and only evaluate", "flag", "e", bool), <del> n_iter=("Number of training iterations", "option", "i", int), <del>) <del>def main(train_loc, dev_loc, model_dir, n_iter=15): <del> with io.open(train_loc, 'r', encoding='utf8') as file_: <del> train_sents = read_conll(file_) <del> if not eval_only: <del> train(English, train_sents, model_dir, n_iter=n_iter) <del> nlp = English(data_dir=model_dir) <del> dev_sents = read_conll(io.open(dev_loc, 'r', encoding='utf8')) <del> scorer = Scorer() <del> for _, sents in dev_sents: <del> for annot_tuples, _ in sents: <del> score_model(scorer, nlp, None, annot_tuples) <del> print('TOK', 100-scorer.token_acc) <del> print('POS', scorer.tags_acc) <del> print('UAS', scorer.uas) <del> print('LAS', scorer.las) <del> <del> <del>if __name__ == '__main__': <del> plac.call(main) <ide><path>bin/parser/train.py <del>#!/usr/bin/env python <del>from __future__ import division <del>from __future__ import unicode_literals <del>from __future__ import print_function <del> <del>import os <del>from os import path <del>import shutil <del>import io <del>import random <del> <del>import plac <del>import re <del> <del>import spacy.util <del> <del>from spacy.syntax.util import Config <del>from spacy.gold import read_json_file <del>from spacy.gold import GoldParse <del>from spacy.gold import merge_sents <del> <del>from spacy.scorer import Scorer <del> <del>from spacy.syntax.arc_eager import ArcEager <del>from spacy.syntax.ner import BiluoPushDown <del>from spacy.tagger import Tagger <del>from spacy.syntax.parser import Parser <del>from spacy.syntax.nonproj import PseudoProjectivity <del> <del> <del>def _corrupt(c, noise_level): <del> if random.random() >= noise_level: <del> return c <del> elif c == ' ': <del> return '\n' <del> elif c == '\n': <del> return ' ' <del> elif c in ['.', "'", "!", "?"]: <del> return '' <del> else: <del> return c.lower() <del> <del> <del>def add_noise(orig, noise_level): <del> if random.random() >= noise_level: <del> return orig <del> elif type(orig) == list: <del> corrupted = [_corrupt(word, noise_level) for word in orig] <del> corrupted = [w for w in corrupted if w] <del> return corrupted <del> else: <del> return ''.join(_corrupt(c, noise_level) for c in orig) <del> <del> <del>def score_model(scorer, nlp, raw_text, annot_tuples, verbose=False): <del> if raw_text is None: <del> tokens = nlp.tokenizer.tokens_from_list(annot_tuples[1]) <del> else: <del> tokens = nlp.tokenizer(raw_text) <del> nlp.tagger(tokens) <del> nlp.entity(tokens) <del> nlp.parser(tokens) <del> gold = GoldParse(tokens, annot_tuples) <del> scorer.score(tokens, gold, verbose=verbose) <del> <del> <del>def train(Language, train_data, dev_data, model_dir, tagger_cfg, parser_cfg, entity_cfg, <del> n_iter=15, seed=0, gold_preproc=False, n_sents=0, corruption_level=0): <del> print("Itn.\tN weight\tN feats\tUAS\tNER F.\tTag %\tToken %") <del> format_str = '{:d}\t{:d}\t{:d}\t{uas:.3f}\t{ents_f:.3f}\t{tags_acc:.3f}\t{token_acc:.3f}' <del> with Language.train(model_dir, train_data, <del> tagger_cfg, parser_cfg, entity_cfg) as trainer: <del> loss = 0 <del> for itn, epoch in enumerate(trainer.epochs(n_iter, gold_preproc=gold_preproc, <del> augment_data=None)): <del> for doc, gold in epoch: <del> trainer.update(doc, gold) <del> dev_scores = trainer.evaluate(dev_data, gold_preproc=gold_preproc) <del> print(format_str.format(itn, trainer.nlp.parser.model.nr_weight, <del> trainer.nlp.parser.model.nr_active_feat, **dev_scores.scores)) <del> <del> <del>def evaluate(Language, gold_tuples, model_dir, gold_preproc=False, verbose=False, <del> beam_width=None, cand_preproc=None): <del> print("Load parser", model_dir) <del> nlp = Language(path=model_dir) <del> if nlp.lang == 'de': <del> nlp.vocab.morphology.lemmatizer = lambda string,pos: set([string]) <del> if beam_width is not None: <del> nlp.parser.cfg.beam_width = beam_width <del> scorer = Scorer() <del> for raw_text, sents in gold_tuples: <del> if gold_preproc: <del> raw_text = None <del> else: <del> sents = merge_sents(sents) <del> for annot_tuples, brackets in sents: <del> if raw_text is None: <del> tokens = nlp.tokenizer.tokens_from_list(annot_tuples[1]) <del> nlp.tagger(tokens) <del> nlp.parser(tokens) <del> nlp.entity(tokens) <del> else: <del> tokens = nlp(raw_text) <del> gold = GoldParse.from_annot_tuples(tokens, annot_tuples) <del> scorer.score(tokens, gold, verbose=verbose) <del> return scorer <del> <del> <del>def write_parses(Language, dev_loc, model_dir, out_loc): <del> nlp = Language(data_dir=model_dir) <del> gold_tuples = read_json_file(dev_loc) <del> scorer = Scorer() <del> out_file = io.open(out_loc, 'w', 'utf8') <del> for raw_text, sents in gold_tuples: <del> sents = _merge_sents(sents) <del> for annot_tuples, brackets in sents: <del> if raw_text is None: <del> tokens = nlp.tokenizer.tokens_from_list(annot_tuples[1]) <del> nlp.tagger(tokens) <del> nlp.entity(tokens) <del> nlp.parser(tokens) <del> else: <del> tokens = nlp(raw_text) <del> #gold = GoldParse(tokens, annot_tuples) <del> #scorer.score(tokens, gold, verbose=False) <del> for sent in tokens.sents: <del> for t in sent: <del> if not t.is_space: <del> out_file.write( <del> '%d\t%s\t%s\t%s\t%s\n' % (t.i, t.orth_, t.tag_, t.head.orth_, t.dep_) <del> ) <del> out_file.write('\n') <del> <del> <del>@plac.annotations( <del> language=("The language to train", "positional", None, str, ['en','de', 'zh']), <del> train_loc=("Location of training file or directory"), <del> dev_loc=("Location of development file or directory"), <del> model_dir=("Location of output model directory",), <del> eval_only=("Skip training, and only evaluate", "flag", "e", bool), <del> corruption_level=("Amount of noise to add to training data", "option", "c", float), <del> gold_preproc=("Use gold-standard sentence boundaries in training?", "flag", "g", bool), <del> out_loc=("Out location", "option", "o", str), <del> n_sents=("Number of training sentences", "option", "n", int), <del> n_iter=("Number of training iterations", "option", "i", int), <del> verbose=("Verbose error reporting", "flag", "v", bool), <del> debug=("Debug mode", "flag", "d", bool), <del> pseudoprojective=("Use pseudo-projective parsing", "flag", "p", bool), <del> L1=("L1 regularization penalty", "option", "L", float), <del>) <del>def main(language, train_loc, dev_loc, model_dir, n_sents=0, n_iter=15, out_loc="", verbose=False, <del> debug=False, corruption_level=0.0, gold_preproc=False, eval_only=False, pseudoprojective=False, <del> L1=1e-6): <del> parser_cfg = dict(locals()) <del> tagger_cfg = dict(locals()) <del> entity_cfg = dict(locals()) <del> <del> lang = spacy.util.get_lang_class(language) <del> <del> parser_cfg['features'] = lang.Defaults.parser_features <del> entity_cfg['features'] = lang.Defaults.entity_features <del> <del> if not eval_only: <del> gold_train = list(read_json_file(train_loc)) <del> gold_dev = list(read_json_file(dev_loc)) <del> if n_sents > 0: <del> gold_train = gold_train[:n_sents] <del> train(lang, gold_train, gold_dev, model_dir, tagger_cfg, parser_cfg, entity_cfg, <del> n_sents=n_sents, gold_preproc=gold_preproc, corruption_level=corruption_level, <del> n_iter=n_iter) <del> if out_loc: <del> write_parses(lang, dev_loc, model_dir, out_loc) <del> scorer = evaluate(lang, list(read_json_file(dev_loc)), <del> model_dir, gold_preproc=gold_preproc, verbose=verbose) <del> print('TOK', scorer.token_acc) <del> print('POS', scorer.tags_acc) <del> print('UAS', scorer.uas) <del> print('LAS', scorer.las) <del> <del> print('NER P', scorer.ents_p) <del> print('NER R', scorer.ents_r) <del> print('NER F', scorer.ents_f) <del> <del> <del>if __name__ == '__main__': <del> plac.call(main) <ide><path>bin/parser/train_ud.py <del>from __future__ import unicode_literals, print_function <del>import plac <del>import json <del>import random <del>import pathlib <del> <del>from spacy.tokens import Doc <del>from spacy.syntax.nonproj import PseudoProjectivity <del>from spacy.language import Language <del>from spacy.gold import GoldParse <del>from spacy.tagger import Tagger <del>from spacy.pipeline import DependencyParser, TokenVectorEncoder <del>from spacy.syntax.parser import get_templates <del>from spacy.syntax.arc_eager import ArcEager <del>from spacy.scorer import Scorer <del>from spacy.language_data.tag_map import TAG_MAP as DEFAULT_TAG_MAP <del>import spacy.attrs <del>import io <del>from thinc.neural.ops import CupyOps <del>from thinc.neural import Model <del>from spacy.es import Spanish <del>from spacy.attrs import POS <del> <del> <del>from thinc.neural import Model <del> <del> <del>try: <del> import cupy <del> from thinc.neural.ops import CupyOps <del>except: <del> cupy = None <del> <del> <del>def read_conllx(loc, n=0): <del> with io.open(loc, 'r', encoding='utf8') as file_: <del> text = file_.read() <del> i = 0 <del> for sent in text.strip().split('\n\n'): <del> lines = sent.strip().split('\n') <del> if lines: <del> while lines[0].startswith('#'): <del> lines.pop(0) <del> tokens = [] <del> for line in lines: <del> id_, word, lemma, pos, tag, morph, head, dep, _1, \ <del> _2 = line.split('\t') <del> if '-' in id_ or '.' in id_: <del> continue <del> try: <del> id_ = int(id_) - 1 <del> head = (int(head) - 1) if head != '0' else id_ <del> dep = 'ROOT' if dep == 'root' else dep #'unlabelled' <del> tag = pos+'__'+dep+'__'+morph <del> Spanish.Defaults.tag_map[tag] = {POS: pos} <del> tokens.append((id_, word, tag, head, dep, 'O')) <del> except: <del> raise <del> tuples = [list(t) for t in zip(*tokens)] <del> yield (None, [[tuples, []]]) <del> i += 1 <del> if n >= 1 and i >= n: <del> break <del> <del> <del>def score_model(vocab, encoder, parser, Xs, ys, verbose=False): <del> scorer = Scorer() <del> correct = 0. <del> total = 0. <del> for doc, gold in zip(Xs, ys): <del> doc = Doc(vocab, words=[w.text for w in doc]) <del> encoder(doc) <del> parser(doc) <del> PseudoProjectivity.deprojectivize(doc) <del> scorer.score(doc, gold, verbose=verbose) <del> for token, tag in zip(doc, gold.tags): <del> if '_' in token.tag_: <del> univ_guess, _ = token.tag_.split('_', 1) <del> else: <del> univ_guess = '' <del> univ_truth, _ = tag.split('_', 1) <del> correct += univ_guess == univ_truth <del> total += 1 <del> return scorer <del> <del> <del>def organize_data(vocab, train_sents): <del> Xs = [] <del> ys = [] <del> for _, doc_sents in train_sents: <del> for (ids, words, tags, heads, deps, ner), _ in doc_sents: <del> doc = Doc(vocab, words=words) <del> gold = GoldParse(doc, tags=tags, heads=heads, deps=deps) <del> Xs.append(doc) <del> ys.append(gold) <del> return Xs, ys <del> <del> <del>def main(lang_name, train_loc, dev_loc, model_dir, clusters_loc=None): <del> LangClass = spacy.util.get_lang_class(lang_name) <del> train_sents = list(read_conllx(train_loc)) <del> dev_sents = list(read_conllx(dev_loc)) <del> train_sents = PseudoProjectivity.preprocess_training_data(train_sents) <del> <del> actions = ArcEager.get_actions(gold_parses=train_sents) <del> features = get_templates('basic') <del> <del> model_dir = pathlib.Path(model_dir) <del> if not model_dir.exists(): <del> model_dir.mkdir() <del> if not (model_dir / 'deps').exists(): <del> (model_dir / 'deps').mkdir() <del> if not (model_dir / 'pos').exists(): <del> (model_dir / 'pos').mkdir() <del> with (model_dir / 'deps' / 'config.json').open('wb') as file_: <del> file_.write( <del> json.dumps( <del> {'pseudoprojective': True, 'labels': actions, 'features': features}).encode('utf8')) <del> <del> vocab = LangClass.Defaults.create_vocab() <del> if not (model_dir / 'vocab').exists(): <del> (model_dir / 'vocab').mkdir() <del> else: <del> if (model_dir / 'vocab' / 'strings.json').exists(): <del> with (model_dir / 'vocab' / 'strings.json').open() as file_: <del> vocab.strings.load(file_) <del> if (model_dir / 'vocab' / 'lexemes.bin').exists(): <del> vocab.load_lexemes(model_dir / 'vocab' / 'lexemes.bin') <del> <del> if clusters_loc is not None: <del> clusters_loc = pathlib.Path(clusters_loc) <del> with clusters_loc.open() as file_: <del> for line in file_: <del> try: <del> cluster, word, freq = line.split() <del> except ValueError: <del> continue <del> lex = vocab[word] <del> lex.cluster = int(cluster[::-1], 2) <del> # Populate vocab <del> for _, doc_sents in train_sents: <del> for (ids, words, tags, heads, deps, ner), _ in doc_sents: <del> for word in words: <del> _ = vocab[word] <del> for dep in deps: <del> _ = vocab[dep] <del> for tag in tags: <del> _ = vocab[tag] <del> if vocab.morphology.tag_map: <del> for tag in tags: <del> vocab.morphology.tag_map[tag] = {POS: tag.split('__', 1)[0]} <del> tagger = Tagger(vocab) <del> encoder = TokenVectorEncoder(vocab, width=64) <del> parser = DependencyParser(vocab, actions=actions, features=features, L1=0.0) <del> <del> Xs, ys = organize_data(vocab, train_sents) <del> dev_Xs, dev_ys = organize_data(vocab, dev_sents) <del> with encoder.model.begin_training(Xs[:100], ys[:100]) as (trainer, optimizer): <del> docs = list(Xs) <del> for doc in docs: <del> encoder(doc) <del> nn_loss = [0.] <del> def track_progress(): <del> with encoder.tagger.use_params(optimizer.averages): <del> with parser.model.use_params(optimizer.averages): <del> scorer = score_model(vocab, encoder, parser, dev_Xs, dev_ys) <del> itn = len(nn_loss) <del> print('%d:\t%.3f\t%.3f\t%.3f' % (itn, nn_loss[-1], scorer.uas, scorer.tags_acc)) <del> nn_loss.append(0.) <del> track_progress() <del> trainer.each_epoch.append(track_progress) <del> trainer.batch_size = 24 <del> trainer.nb_epoch = 40 <del> for docs, golds in trainer.iterate(Xs, ys, progress_bar=True): <del> docs = [Doc(vocab, words=[w.text for w in doc]) for doc in docs] <del> tokvecs, upd_tokvecs = encoder.begin_update(docs) <del> for doc, tokvec in zip(docs, tokvecs): <del> doc.tensor = tokvec <del> d_tokvecs = parser.update(docs, golds, sgd=optimizer) <del> upd_tokvecs(d_tokvecs, sgd=optimizer) <del> encoder.update(docs, golds, sgd=optimizer) <del> nlp = LangClass(vocab=vocab, parser=parser) <del> scorer = score_model(vocab, encoder, parser, read_conllx(dev_loc)) <del> print('%d:\t%.3f\t%.3f\t%.3f' % (itn, scorer.uas, scorer.las, scorer.tags_acc)) <del> #nlp.end_training(model_dir) <del> #scorer = score_model(vocab, tagger, parser, read_conllx(dev_loc)) <del> #print('%d:\t%.3f\t%.3f\t%.3f' % (itn, scorer.uas, scorer.las, scorer.tags_acc)) <del> <del> <del>if __name__ == '__main__': <del> import cProfile <del> import pstats <del> if 1: <del> plac.call(main) <del> else: <del> cProfile.runctx("plac.call(main)", globals(), locals(), "Profile.prof") <del> s = pstats.Stats("Profile.prof") <del> s.strip_dirs().sort_stats("time").print_stats() <del> <del> <del> plac.call(main) <ide><path>bin/prepare_treebank.py <del>"""Convert OntoNotes into a json format. <del> <del>doc: { <del> id: string, <del> paragraphs: [{ <del> raw: string, <del> sents: [int], <del> tokens: [{ <del> start: int, <del> tag: string, <del> head: int, <del> dep: string}], <del> ner: [{ <del> start: int, <del> end: int, <del> label: string}], <del> brackets: [{ <del> start: int, <del> end: int, <del> label: string}]}]} <del> <del>Consumes output of spacy/munge/align_raw.py <del>""" <del>from __future__ import unicode_literals <del>import plac <del>import json <del>from os import path <del>import os <del>import re <del>import io <del>from collections import defaultdict <del> <del>from spacy.munge import read_ptb <del>from spacy.munge import read_conll <del>from spacy.munge import read_ner <del> <del> <del>def _iter_raw_files(raw_loc): <del> files = json.load(open(raw_loc)) <del> for f in files: <del> yield f <del> <del> <del>def format_doc(file_id, raw_paras, ptb_text, dep_text, ner_text): <del> ptb_sents = read_ptb.split(ptb_text) <del> dep_sents = read_conll.split(dep_text) <del> if len(ptb_sents) != len(dep_sents): <del> return None <del> if ner_text is not None: <del> ner_sents = read_ner.split(ner_text) <del> else: <del> ner_sents = [None] * len(ptb_sents) <del> <del> i = 0 <del> doc = {'id': file_id} <del> if raw_paras is None: <del> doc['paragraphs'] = [format_para(None, ptb_sents, dep_sents, ner_sents)] <del> #for ptb_sent, dep_sent, ner_sent in zip(ptb_sents, dep_sents, ner_sents): <del> # doc['paragraphs'].append(format_para(None, [ptb_sent], [dep_sent], [ner_sent])) <del> else: <del> doc['paragraphs'] = [] <del> for raw_sents in raw_paras: <del> para = format_para( <del> ' '.join(raw_sents).replace('<SEP>', ''), <del> ptb_sents[i:i+len(raw_sents)], <del> dep_sents[i:i+len(raw_sents)], <del> ner_sents[i:i+len(raw_sents)]) <del> if para['sentences']: <del> doc['paragraphs'].append(para) <del> i += len(raw_sents) <del> return doc <del> <del> <del>def format_para(raw_text, ptb_sents, dep_sents, ner_sents): <del> para = {'raw': raw_text, 'sentences': []} <del> offset = 0 <del> assert len(ptb_sents) == len(dep_sents) == len(ner_sents) <del> for ptb_text, dep_text, ner_text in zip(ptb_sents, dep_sents, ner_sents): <del> _, deps = read_conll.parse(dep_text, strip_bad_periods=True) <del> if deps and 'VERB' in [t['tag'] for t in deps]: <del> continue <del> if ner_text is not None: <del> _, ner = read_ner.parse(ner_text, strip_bad_periods=True) <del> else: <del> ner = ['-' for _ in deps] <del> _, brackets = read_ptb.parse(ptb_text, strip_bad_periods=True) <del> # Necessary because the ClearNLP converter deletes EDITED words. <del> if len(ner) != len(deps): <del> ner = ['-' for _ in deps] <del> para['sentences'].append(format_sentence(deps, ner, brackets)) <del> return para <del> <del> <del>def format_sentence(deps, ner, brackets): <del> sent = {'tokens': [], 'brackets': []} <del> for token_id, (token, token_ent) in enumerate(zip(deps, ner)): <del> sent['tokens'].append(format_token(token_id, token, token_ent)) <del> <del> for label, start, end in brackets: <del> if start != end: <del> sent['brackets'].append({ <del> 'label': label, <del> 'first': start, <del> 'last': (end-1)}) <del> return sent <del> <del> <del>def format_token(token_id, token, ner): <del> assert token_id == token['id'] <del> head = (token['head'] - token_id) if token['head'] != -1 else 0 <del> return { <del> 'id': token_id, <del> 'orth': token['word'], <del> 'tag': token['tag'], <del> 'head': head, <del> 'dep': token['dep'], <del> 'ner': ner} <del> <del> <del>def read_file(*pieces): <del> loc = path.join(*pieces) <del> if not path.exists(loc): <del> return None <del> else: <del> return io.open(loc, 'r', encoding='utf8').read().strip() <del> <del> <del>def get_file_names(section_dir, subsection): <del> filenames = [] <del> for fn in os.listdir(path.join(section_dir, subsection)): <del> filenames.append(fn.rsplit('.', 1)[0]) <del> return list(sorted(set(filenames))) <del> <del> <del>def read_wsj_with_source(onto_dir, raw_dir): <del> # Now do WSJ, with source alignment <del> onto_dir = path.join(onto_dir, 'data', 'english', 'annotations', 'nw', 'wsj') <del> docs = {} <del> for i in range(25): <del> section = str(i) if i >= 10 else ('0' + str(i)) <del> raw_loc = path.join(raw_dir, 'wsj%s.json' % section) <del> for j, (filename, raw_paras) in enumerate(_iter_raw_files(raw_loc)): <del> if section == '00': <del> j += 1 <del> if section == '04' and filename == '55': <del> continue <del> ptb = read_file(onto_dir, section, '%s.parse' % filename) <del> dep = read_file(onto_dir, section, '%s.parse.dep' % filename) <del> ner = read_file(onto_dir, section, '%s.name' % filename) <del> if ptb is not None and dep is not None: <del> docs[filename] = format_doc(filename, raw_paras, ptb, dep, ner) <del> return docs <del> <del> <del>def get_doc(onto_dir, file_path, wsj_docs): <del> filename = file_path.rsplit('/', 1)[1] <del> if filename in wsj_docs: <del> return wsj_docs[filename] <del> else: <del> ptb = read_file(onto_dir, file_path + '.parse') <del> dep = read_file(onto_dir, file_path + '.parse.dep') <del> ner = read_file(onto_dir, file_path + '.name') <del> if ptb is not None and dep is not None: <del> return format_doc(filename, None, ptb, dep, ner) <del> else: <del> return None <del> <del> <del>def read_ids(loc): <del> return open(loc).read().strip().split('\n') <del> <del> <del>def main(onto_dir, raw_dir, out_dir): <del> wsj_docs = read_wsj_with_source(onto_dir, raw_dir) <del> <del> for partition in ('train', 'test', 'development'): <del> ids = read_ids(path.join(onto_dir, '%s.id' % partition)) <del> docs_by_genre = defaultdict(list) <del> for file_path in ids: <del> doc = get_doc(onto_dir, file_path, wsj_docs) <del> if doc is not None: <del> genre = file_path.split('/')[3] <del> docs_by_genre[genre].append(doc) <del> part_dir = path.join(out_dir, partition) <del> if not path.exists(part_dir): <del> os.mkdir(part_dir) <del> for genre, docs in sorted(docs_by_genre.items()): <del> out_loc = path.join(part_dir, genre + '.json') <del> with open(out_loc, 'w') as file_: <del> json.dump(docs, file_, indent=4) <del> <del> <del>if __name__ == '__main__': <del> plac.call(main) <ide><path>bin/prepare_vecs.py <del>"""Read a vector file, and prepare it as binary data, for easy consumption""" <del> <del>import plac <del> <del>from spacy.vocab import write_binary_vectors <del> <del> <del>def main(in_loc, out_loc): <del> write_binary_vectors(in_loc, out_loc) <del> <del> <del>if __name__ == '__main__': <del> plac.call(main) <ide><path>bin/tagger/train.py <del>#!/usr/bin/env python <del>from __future__ import division <del>from __future__ import unicode_literals <del>from __future__ import print_function <del> <del>import os <del>from os import path <del>import shutil <del>import codecs <del>import random <del> <del>import plac <del>import re <del> <del>import spacy.util <del>from spacy.en import English <del> <del>from spacy.tagger import Tagger <del> <del>from spacy.syntax.util import Config <del>from spacy.gold import read_json_file <del>from spacy.gold import GoldParse <del> <del>from spacy.scorer import Scorer <del> <del> <del>def score_model(scorer, nlp, raw_text, annot_tuples): <del> if raw_text is None: <del> tokens = nlp.tokenizer.tokens_from_list(annot_tuples[1]) <del> else: <del> tokens = nlp.tokenizer(raw_text) <del> nlp.tagger(tokens) <del> gold = GoldParse(tokens, annot_tuples) <del> scorer.score(tokens, gold) <del> <del> <del>def _merge_sents(sents): <del> m_deps = [[], [], [], [], [], []] <del> m_brackets = [] <del> i = 0 <del> for (ids, words, tags, heads, labels, ner), brackets in sents: <del> m_deps[0].extend(id_ + i for id_ in ids) <del> m_deps[1].extend(words) <del> m_deps[2].extend(tags) <del> m_deps[3].extend(head + i for head in heads) <del> m_deps[4].extend(labels) <del> m_deps[5].extend(ner) <del> m_brackets.extend((b['first'] + i, b['last'] + i, b['label']) for b in brackets) <del> i += len(ids) <del> return [(m_deps, m_brackets)] <del> <del> <del>def train(Language, gold_tuples, model_dir, n_iter=15, feat_set=u'basic', <del> seed=0, gold_preproc=False, n_sents=0, corruption_level=0, <del> beam_width=1, verbose=False, <del> use_orig_arc_eager=False): <del> if n_sents > 0: <del> gold_tuples = gold_tuples[:n_sents] <del> <del> templates = Tagger.default_templates() <del> nlp = Language(data_dir=model_dir, tagger=False) <del> nlp.tagger = Tagger.blank(nlp.vocab, templates) <del> <del> print("Itn.\tP.Loss\tUAS\tNER F.\tTag %\tToken %") <del> for itn in range(n_iter): <del> scorer = Scorer() <del> loss = 0 <del> for raw_text, sents in gold_tuples: <del> if gold_preproc: <del> raw_text = None <del> else: <del> sents = _merge_sents(sents) <del> for annot_tuples, ctnt in sents: <del> words = annot_tuples[1] <del> gold_tags = annot_tuples[2] <del> score_model(scorer, nlp, raw_text, annot_tuples) <del> if raw_text is None: <del> tokens = nlp.tokenizer.tokens_from_list(words) <del> else: <del> tokens = nlp.tokenizer(raw_text) <del> loss += nlp.tagger.train(tokens, gold_tags) <del> random.shuffle(gold_tuples) <del> print('%d:\t%d\t%.3f\t%.3f\t%.3f\t%.3f' % (itn, loss, scorer.uas, scorer.ents_f, <del> scorer.tags_acc, <del> scorer.token_acc)) <del> nlp.end_training(model_dir) <del> <del>def evaluate(Language, gold_tuples, model_dir, gold_preproc=False, verbose=False, <del> beam_width=None): <del> nlp = Language(data_dir=model_dir) <del> if beam_width is not None: <del> nlp.parser.cfg.beam_width = beam_width <del> scorer = Scorer() <del> for raw_text, sents in gold_tuples: <del> if gold_preproc: <del> raw_text = None <del> else: <del> sents = _merge_sents(sents) <del> for annot_tuples, brackets in sents: <del> if raw_text is None: <del> tokens = nlp.tokenizer.tokens_from_list(annot_tuples[1]) <del> nlp.tagger(tokens) <del> nlp.entity(tokens) <del> nlp.parser(tokens) <del> else: <del> tokens = nlp(raw_text, merge_mwes=False) <del> gold = GoldParse(tokens, annot_tuples) <del> scorer.score(tokens, gold, verbose=verbose) <del> return scorer <del> <del> <del>def write_parses(Language, dev_loc, model_dir, out_loc, beam_width=None): <del> nlp = Language(data_dir=model_dir) <del> if beam_width is not None: <del> nlp.parser.cfg.beam_width = beam_width <del> gold_tuples = read_json_file(dev_loc) <del> scorer = Scorer() <del> out_file = codecs.open(out_loc, 'w', 'utf8') <del> for raw_text, sents in gold_tuples: <del> sents = _merge_sents(sents) <del> for annot_tuples, brackets in sents: <del> if raw_text is None: <del> tokens = nlp.tokenizer.tokens_from_list(annot_tuples[1]) <del> nlp.tagger(tokens) <del> nlp.entity(tokens) <del> nlp.parser(tokens) <del> else: <del> tokens = nlp(raw_text, merge_mwes=False) <del> gold = GoldParse(tokens, annot_tuples) <del> scorer.score(tokens, gold, verbose=False) <del> for t in tokens: <del> out_file.write( <del> '%s\t%s\t%s\t%s\n' % (t.orth_, t.tag_, t.head.orth_, t.dep_) <del> ) <del> return scorer <del> <del> <del>@plac.annotations( <del> train_loc=("Location of training file or directory"), <del> dev_loc=("Location of development file or directory"), <del> model_dir=("Location of output model directory",), <del> eval_only=("Skip training, and only evaluate", "flag", "e", bool), <del> corruption_level=("Amount of noise to add to training data", "option", "c", float), <del> gold_preproc=("Use gold-standard sentence boundaries in training?", "flag", "g", bool), <del> out_loc=("Out location", "option", "o", str), <del> n_sents=("Number of training sentences", "option", "n", int), <del> n_iter=("Number of training iterations", "option", "i", int), <del> verbose=("Verbose error reporting", "flag", "v", bool), <del> debug=("Debug mode", "flag", "d", bool), <del>) <del>def main(train_loc, dev_loc, model_dir, n_sents=0, n_iter=15, out_loc="", verbose=False, <del> debug=False, corruption_level=0.0, gold_preproc=False, eval_only=False): <del> if not eval_only: <del> gold_train = list(read_json_file(train_loc)) <del> train(English, gold_train, model_dir, <del> feat_set='basic' if not debug else 'debug', <del> gold_preproc=gold_preproc, n_sents=n_sents, <del> corruption_level=corruption_level, n_iter=n_iter, <del> verbose=verbose) <del> #if out_loc: <del> # write_parses(English, dev_loc, model_dir, out_loc, beam_width=beam_width) <del> scorer = evaluate(English, list(read_json_file(dev_loc)), <del> model_dir, gold_preproc=gold_preproc, verbose=verbose) <del> print('TOK', scorer.token_acc) <del> print('POS', scorer.tags_acc) <del> print('UAS', scorer.uas) <del> print('LAS', scorer.las) <del> <del> print('NER P', scorer.ents_p) <del> print('NER R', scorer.ents_r) <del> print('NER F', scorer.ents_f) <del> <del> <del>if __name__ == '__main__': <del> plac.call(main) <ide><path>bin/tagger/train_german_tagger.py <del>#!/usr/bin/env python <del>from __future__ import division <del>from __future__ import unicode_literals <del> <del>import os <del>from os import path <del>import shutil <del>import io <del>import random <del>import time <del>import gzip <del>import ujson <del> <del>import plac <del>import cProfile <del>import pstats <del> <del>import spacy.util <del>from spacy.de import German <del>from spacy.gold import GoldParse <del>from spacy.tagger import Tagger <del>from spacy.scorer import PRFScore <del> <del>from spacy.tagger import P2_orth, P2_cluster, P2_shape, P2_prefix, P2_suffix, P2_pos, P2_lemma, P2_flags <del>from spacy.tagger import P1_orth, P1_cluster, P1_shape, P1_prefix, P1_suffix, P1_pos, P1_lemma, P1_flags <del>from spacy.tagger import W_orth, W_cluster, W_shape, W_prefix, W_suffix, W_pos, W_lemma, W_flags <del>from spacy.tagger import N1_orth, N1_cluster, N1_shape, N1_prefix, N1_suffix, N1_pos, N1_lemma, N1_flags <del>from spacy.tagger import N2_orth, N2_cluster, N2_shape, N2_prefix, N2_suffix, N2_pos, N2_lemma, N2_flags, N_CONTEXT_FIELDS <del> <del> <del>def default_templates(): <del> return spacy.tagger.Tagger.default_templates() <del> <del>def default_templates_without_clusters(): <del> return ( <del> (W_orth,), <del> (P1_lemma, P1_pos), <del> (P2_lemma, P2_pos), <del> (N1_orth,), <del> (N2_orth,), <del> <del> (W_suffix,), <del> (W_prefix,), <del> <del> (P1_pos,), <del> (P2_pos,), <del> (P1_pos, P2_pos), <del> (P1_pos, W_orth), <del> (P1_suffix,), <del> (N1_suffix,), <del> <del> (W_shape,), <del> <del> (W_flags,), <del> (N1_flags,), <del> (N2_flags,), <del> (P1_flags,), <del> (P2_flags,), <del> ) <del> <del> <del>def make_tagger(vocab, templates): <del> model = spacy.tagger.TaggerModel(templates) <del> return spacy.tagger.Tagger(vocab,model) <del> <del> <del>def read_conll(file_): <del> def sentences(): <del> words, tags = [], [] <del> for line in file_: <del> line = line.strip() <del> if line: <del> word, tag = line.split('\t')[1::3][:2] # get column 1 and 4 (CoNLL09) <del> words.append(word) <del> tags.append(tag) <del> elif words: <del> yield words, tags <del> words, tags = [], [] <del> if words: <del> yield words, tags <del> return [ s for s in sentences() ] <del> <del> <del>def score_model(score, nlp, words, gold_tags): <del> tokens = nlp.tokenizer.tokens_from_list(words) <del> assert(len(tokens) == len(gold_tags)) <del> nlp.tagger(tokens) <del> <del> for token, gold_tag in zip(tokens,gold_tags): <del> score.score_set(set([token.tag_]),set([gold_tag])) <del> <del> <del>def train(Language, train_sents, dev_sents, model_dir, n_iter=15, seed=21): <del> # make shuffling deterministic <del> random.seed(seed) <del> <del> # set up directory for model <del> pos_model_dir = path.join(model_dir, 'pos') <del> if path.exists(pos_model_dir): <del> shutil.rmtree(pos_model_dir) <del> os.mkdir(pos_model_dir) <del> <del> nlp = Language(data_dir=model_dir, tagger=False, parser=False, entity=False) <del> nlp.tagger = make_tagger(nlp.vocab,default_templates()) <del> <del> print("Itn.\ttrain acc %\tdev acc %") <del> for itn in range(n_iter): <del> # train on train set <del> #train_acc = PRFScore() <del> correct, total = 0., 0. <del> for words, gold_tags in train_sents: <del> tokens = nlp.tokenizer.tokens_from_list(words) <del> correct += nlp.tagger.train(tokens, gold_tags) <del> total += len(words) <del> train_acc = correct/total <del> <del> # test on dev set <del> dev_acc = PRFScore() <del> for words, gold_tags in dev_sents: <del> score_model(dev_acc, nlp, words, gold_tags) <del> <del> random.shuffle(train_sents) <del> print('%d:\t%6.2f\t%6.2f' % (itn, 100*train_acc, 100*dev_acc.precision)) <del> <del> <del> print('end training') <del> nlp.end_training(model_dir) <del> print('done') <del> <del> <del>@plac.annotations( <del> train_loc=("Location of CoNLL 09 formatted training file"), <del> dev_loc=("Location of CoNLL 09 formatted development file"), <del> model_dir=("Location of output model directory"), <del> eval_only=("Skip training, and only evaluate", "flag", "e", bool), <del> n_iter=("Number of training iterations", "option", "i", int), <del>) <del>def main(train_loc, dev_loc, model_dir, eval_only=False, n_iter=15): <del> # training <del> if not eval_only: <del> with io.open(train_loc, 'r', encoding='utf8') as trainfile_, \ <del> io.open(dev_loc, 'r', encoding='utf8') as devfile_: <del> train_sents = read_conll(trainfile_) <del> dev_sents = read_conll(devfile_) <del> train(German, train_sents, dev_sents, model_dir, n_iter=n_iter) <del> <del> # testing <del> with io.open(dev_loc, 'r', encoding='utf8') as file_: <del> dev_sents = read_conll(file_) <del> nlp = German(data_dir=model_dir) <del> <del> dev_acc = PRFScore() <del> for words, gold_tags in dev_sents: <del> score_model(dev_acc, nlp, words, gold_tags) <del> <del> print('POS: %6.2f %%' % (100*dev_acc.precision)) <del> <del> <del>if __name__ == '__main__': <del> plac.call(main)
10
Go
Go
expose trust key path in config
e428c824c35e85a02fffee592b79ab7db1a0c4d2
<ide><path>cli/flags/common.go <ide> import ( <ide> ) <ide> <ide> const ( <del> // DefaultTrustKeyFile is the default filename for the trust key <del> DefaultTrustKeyFile = "key.json" <ide> // DefaultCaFile is the default filename for the CA pem file <ide> DefaultCaFile = "ca.pem" <ide> // DefaultKeyFile is the default filename for the key pem file <ide> type CommonOptions struct { <ide> TLS bool <ide> TLSVerify bool <ide> TLSOptions *tlsconfig.Options <del> TrustKey string <ide> } <ide> <ide> // NewCommonOptions returns a new CommonOptions <ide><path>cmd/dockerd/config.go <ide> import ( <ide> const ( <ide> // defaultShutdownTimeout is the default shutdown timeout for the daemon <ide> defaultShutdownTimeout = 15 <add> // defaultTrustKeyFile is the default filename for the trust key <add> defaultTrustKeyFile = "key.json" <ide> ) <ide> <ide> // installCommonConfigFlags adds flags to the pflag.FlagSet to configure the daemon <ide> func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) { <ide> <ide> flags.StringVar(&conf.MetricsAddress, "metrics-addr", "", "Set default address and port to serve the metrics api on") <ide> <add> // "--deprecated-key-path" is to allow configuration of the key used <add> // for the daemon ID and the deprecated image signing. It was never <add> // exposed as a command line option but is added here to allow <add> // overriding the default path in configuration. <add> flags.Var(opts.NewQuotedString(&conf.TrustKeyPath), "deprecated-key-path", "Path to key file for ID and image signing") <add> flags.MarkHidden("deprecated-key-path") <add> <ide> conf.MaxConcurrentDownloads = &maxConcurrentDownloads <ide> conf.MaxConcurrentUploads = &maxConcurrentUploads <ide> } <ide><path>cmd/dockerd/daemon.go <ide> package main <ide> import ( <ide> "crypto/tls" <ide> "fmt" <del> "io" <ide> "os" <ide> "path/filepath" <del> "runtime" <ide> "strings" <ide> "time" <ide> <ide> import ( <ide> swarmrouter "github.com/docker/docker/api/server/router/swarm" <ide> systemrouter "github.com/docker/docker/api/server/router/system" <ide> "github.com/docker/docker/api/server/router/volume" <del> "github.com/docker/docker/cli" <ide> "github.com/docker/docker/cli/debug" <ide> cliflags "github.com/docker/docker/cli/flags" <ide> "github.com/docker/docker/daemon" <ide> import ( <ide> "github.com/docker/docker/pkg/pidfile" <ide> "github.com/docker/docker/pkg/plugingetter" <ide> "github.com/docker/docker/pkg/signal" <del> "github.com/docker/docker/pkg/system" <ide> "github.com/docker/docker/plugin" <ide> "github.com/docker/docker/registry" <ide> "github.com/docker/docker/runconfig" <ide> func NewDaemonCli() *DaemonCli { <ide> return &DaemonCli{} <ide> } <ide> <del>func migrateKey(config *config.Config) (err error) { <del> // No migration necessary on Windows <del> if runtime.GOOS == "windows" { <del> return nil <del> } <del> <del> // Migrate trust key if exists at ~/.docker/key.json and owned by current user <del> oldPath := filepath.Join(cli.ConfigurationDir(), cliflags.DefaultTrustKeyFile) <del> newPath := filepath.Join(getDaemonConfDir(config.Root), cliflags.DefaultTrustKeyFile) <del> if _, statErr := os.Stat(newPath); os.IsNotExist(statErr) && currentUserIsOwner(oldPath) { <del> defer func() { <del> // Ensure old path is removed if no error occurred <del> if err == nil { <del> err = os.Remove(oldPath) <del> } else { <del> logrus.Warnf("Key migration failed, key file not removed at %s", oldPath) <del> os.Remove(newPath) <del> } <del> }() <del> <del> if err := system.MkdirAll(getDaemonConfDir(config.Root), os.FileMode(0644)); err != nil { <del> return fmt.Errorf("Unable to create daemon configuration directory: %s", err) <del> } <del> <del> newFile, err := os.OpenFile(newPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) <del> if err != nil { <del> return fmt.Errorf("error creating key file %q: %s", newPath, err) <del> } <del> defer newFile.Close() <del> <del> oldFile, err := os.Open(oldPath) <del> if err != nil { <del> return fmt.Errorf("error opening key file %q: %s", oldPath, err) <del> } <del> defer oldFile.Close() <del> <del> if _, err := io.Copy(newFile, oldFile); err != nil { <del> return fmt.Errorf("error copying key: %s", err) <del> } <del> <del> logrus.Infof("Migrated key from %s to %s", oldPath, newPath) <del> } <del> <del> return nil <del>} <del> <ide> func (cli *DaemonCli) start(opts daemonOptions) (err error) { <ide> stopc := make(chan bool) <ide> defer close(stopc) <ide> func (cli *DaemonCli) start(opts daemonOptions) (err error) { <ide> cli.configFile = &opts.configFile <ide> cli.flags = opts.flags <ide> <del> if opts.common.TrustKey == "" { <del> opts.common.TrustKey = filepath.Join( <del> getDaemonConfDir(cli.Config.Root), <del> cliflags.DefaultTrustKeyFile) <del> } <del> <ide> if cli.Config.Debug { <ide> debug.Enable() <ide> } <ide> func (cli *DaemonCli) start(opts daemonOptions) (err error) { <ide> api.Accept(addr, ls...) <ide> } <ide> <del> if err := migrateKey(cli.Config); err != nil { <del> return err <del> } <del> <del> // FIXME: why is this down here instead of with the other TrustKey logic above? <del> cli.TrustKeyPath = opts.common.TrustKey <del> <ide> registryService := registry.NewService(cli.Config.ServiceOptions) <ide> containerdRemote, err := libcontainerd.New(cli.getLibcontainerdRoot(), cli.getPlatformRemoteOptions()...) <ide> if err != nil { <ide> func loadDaemonCliConfig(opts daemonOptions) (*config.Config, error) { <ide> conf.CommonTLSOptions.KeyFile = opts.common.TLSOptions.KeyFile <ide> } <ide> <add> if conf.TrustKeyPath == "" { <add> conf.TrustKeyPath = filepath.Join( <add> getDaemonConfDir(conf.Root), <add> defaultTrustKeyFile) <add> } <add> <ide> if flags.Changed("graph") && flags.Changed("data-root") { <ide> return nil, fmt.Errorf(`cannot specify both "--graph" and "--data-root" option`) <ide> } <ide><path>cmd/dockerd/daemon_unix.go <ide> import ( <ide> "github.com/docker/docker/cmd/dockerd/hack" <ide> "github.com/docker/docker/daemon" <ide> "github.com/docker/docker/libcontainerd" <del> "github.com/docker/docker/pkg/system" <ide> "github.com/docker/libnetwork/portallocator" <ide> ) <ide> <ide> const defaultDaemonConfigFile = "/etc/docker/daemon.json" <ide> <del>// currentUserIsOwner checks whether the current user is the owner of the given <del>// file. <del>func currentUserIsOwner(f string) bool { <del> if fileInfo, err := system.Stat(f); err == nil && fileInfo != nil { <del> if int(fileInfo.UID()) == os.Getuid() { <del> return true <del> } <del> } <del> return false <del>} <del> <ide> // setDefaultUmask sets the umask to 0022 to avoid problems <ide> // caused by custom umask <ide> func setDefaultUmask() error { <ide><path>daemon/config/config.go <ide> type CommonConfig struct { <ide> RootDeprecated string `json:"graph,omitempty"` <ide> Root string `json:"data-root,omitempty"` <ide> SocketGroup string `json:"group,omitempty"` <del> TrustKeyPath string `json:"-"` <ide> CorsHeaders string `json:"api-cors-header,omitempty"` <ide> EnableCors bool `json:"api-enable-cors,omitempty"` <ide> <add> // TrustKeyPath is used to generate the daemon ID and for signing schema 1 manifests <add> // when pushing to a registry which does not support schema 2. This field is marked as <add> // deprecated because schema 1 manifests are deprecated in favor of schema 2 and the <add> // daemon ID will use a dedicated identifier not shared with exported signatures. <add> TrustKeyPath string `json:"deprecated-key-path,omitempty"` <add> <ide> // LiveRestoreEnabled determines whether we should keep containers <ide> // alive upon daemon shutdown/start <ide> LiveRestoreEnabled bool `json:"live-restore,omitempty"` <ide><path>integration-cli/docker_cli_daemon_test.go <ide> func (s *DockerDaemonSuite) TestDaemonKeyGeneration(c *check.C) { <ide> } <ide> } <ide> <del>func (s *DockerDaemonSuite) TestDaemonKeyMigration(c *check.C) { <del> // TODO: skip or update for Windows daemon <del> os.Remove("/etc/docker/key.json") <del> k1, err := libtrust.GenerateECP256PrivateKey() <del> if err != nil { <del> c.Fatalf("Error generating private key: %s", err) <del> } <del> if err := os.MkdirAll(filepath.Join(os.Getenv("HOME"), ".docker"), 0755); err != nil { <del> c.Fatalf("Error creating .docker directory: %s", err) <del> } <del> if err := libtrust.SaveKey(filepath.Join(os.Getenv("HOME"), ".docker", "key.json"), k1); err != nil { <del> c.Fatalf("Error saving private key: %s", err) <del> } <del> <del> s.d.Start(c) <del> s.d.Stop(c) <del> <del> k2, err := libtrust.LoadKeyFile("/etc/docker/key.json") <del> if err != nil { <del> c.Fatalf("Error opening key file") <del> } <del> if k1.KeyID() != k2.KeyID() { <del> c.Fatalf("Key not migrated") <del> } <del>} <del> <ide> // GH#11320 - verify that the daemon exits on failure properly <ide> // Note that this explicitly tests the conflict of {-b,--bridge} and {--bip} options as the means <ide> // to get a daemon init failure; no other tests for -b/--bip conflict are therefore required
6
Javascript
Javascript
provide backpressure for pipeline flood
085dd30e93da67362f044ad1b3b6b2d997064692
<ide><path>lib/_http_common.js <ide> function parserOnMessageComplete() { <ide> stream.push(null); <ide> } <ide> <del> if (parser.socket.readable) { <del> // force to read the next incoming message <del> readStart(parser.socket); <del> } <add> // force to read the next incoming message <add> readStart(parser.socket); <ide> } <ide> <ide> <ide><path>lib/_http_incoming.js <ide> var util = require('util'); <ide> var Stream = require('stream'); <ide> <ide> function readStart(socket) { <del> if (socket) <add> if (socket && !socket._paused && socket.readable) <ide> socket.resume(); <ide> } <ide> exports.readStart = readStart; <ide><path>lib/_http_server.js <ide> function connectionListener(socket) { <ide> } <ide> <ide> function socketOnData(d) { <add> assert(!socket._paused); <ide> debug('SERVER socketOnData %d', d.length); <ide> var ret = parser.execute(d); <ide> if (ret instanceof Error) { <ide> function connectionListener(socket) { <ide> socket.destroy(); <ide> } <ide> } <add> <add> if (socket._paused) { <add> // onIncoming paused the socket, we should pause the parser as well <add> debug('pause parser'); <add> socket.parser.pause(); <add> } <ide> } <ide> <ide> function socketOnEnd() { <ide> function connectionListener(socket) { <ide> // new message. In this callback we setup the response object and pass it <ide> // to the user. <ide> <add> socket._paused = false; <add> function socketOnDrain() { <add> // If we previously paused, then start reading again. <add> if (socket._paused) { <add> socket._paused = false; <add> socket.parser.resume(); <add> socket.resume(); <add> } <add> } <add> socket.on('drain', socketOnDrain); <add> <ide> function parserOnIncoming(req, shouldKeepAlive) { <ide> incoming.push(req); <ide> <add> // If the writable end isn't consuming, then stop reading <add> // so that we don't become overwhelmed by a flood of <add> // pipelined requests that may never be resolved. <add> if (!socket._paused) { <add> var needPause = socket._writableState.needDrain; <add> if (needPause) { <add> socket._paused = true; <add> // We also need to pause the parser, but don't do that until after <add> // the call to execute, because we may still be processing the last <add> // chunk. <add> socket.pause(); <add> } <add> } <add> <ide> var res = new ServerResponse(req); <ide> <ide> res.shouldKeepAlive = shouldKeepAlive; <ide><path>test/simple/test-http-pipeline-flood.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <add>var common = require('../common'); <add>var assert = require('assert'); <add> <add>switch (process.argv[2]) { <add> case undefined: <add> return parent(); <add> case 'child': <add> return child(); <add> default: <add> throw new Error('wtf'); <add>} <add> <add>function parent() { <add> var http = require('http'); <add> var bigResponse = new Buffer(10240).fill('x'); <add> var gotTimeout = false; <add> var childClosed = false; <add> var requests = 0; <add> var connections = 0; <add> <add> var server = http.createServer(function(req, res) { <add> requests++; <add> res.setHeader('content-length', bigResponse.length); <add> res.end(bigResponse); <add> }); <add> <add> server.on('connection', function(conn) { <add> connections++; <add> }); <add> <add> // kill the connection after a bit, verifying that the <add> // flood of requests was eventually halted. <add> server.setTimeout(200, function(conn) { <add> gotTimeout = true; <add> conn.destroy(); <add> }); <add> <add> server.listen(common.PORT, function() { <add> var spawn = require('child_process').spawn; <add> var args = [__filename, 'child']; <add> var child = spawn(process.execPath, args, { stdio: 'inherit' }); <add> child.on('close', function(code) { <add> assert(!code); <add> childClosed = true; <add> server.close(); <add> }); <add> }); <add> <add> process.on('exit', function() { <add> assert(gotTimeout); <add> assert(childClosed); <add> assert.equal(connections, 1); <add> // 1213 works out to be the number of requests we end up processing <add> // before the outgoing connection backs up and requires a drain. <add> // however, to avoid being unnecessarily tied to a specific magic number, <add> // and making the test brittle, just assert that it's "a lot", which we <add> // can safely assume is more than 500. <add> assert(requests >= 500); <add> console.log('ok'); <add> }); <add>} <add> <add>function child() { <add> var net = require('net'); <add> <add> var gotEpipe = false; <add> var conn = net.connect({ port: common.PORT }); <add> <add> var req = 'GET / HTTP/1.1\r\nHost: localhost:' + <add> common.PORT + '\r\nAccept: */*\r\n\r\n'; <add> <add> req = new Array(10241).join(req); <add> <add> conn.on('connect', function() { <add> write(); <add> }); <add> <add> conn.on('drain', write); <add> <add> conn.on('error', function(er) { <add> gotEpipe = true; <add> }); <add> <add> process.on('exit', function() { <add> assert(gotEpipe); <add> console.log('ok - child'); <add> }); <add> <add> function write() { <add> while (false !== conn.write(req, 'ascii')); <add> } <add>}
4
Go
Go
return a specific error if plugin is disabled
e33d598059d8af8c57995a2c52f1f9f5691c09e8
<ide><path>plugin/store.go <ide> func (name ErrAmbiguous) Error() string { <ide> return fmt.Sprintf("multiple plugins found for %q", string(name)) <ide> } <ide> <add>// ErrDisabled indicates that a plugin was found but it is disabled <add>type ErrDisabled string <add> <add>func (name ErrDisabled) Error() string { <add> return fmt.Sprintf("plugin %s found but disabled", string(name)) <add>} <add> <ide> // GetV2Plugin retrieves a plugin by name, id or partial ID. <ide> func (ps *Store) GetV2Plugin(refOrID string) (*v2.Plugin, error) { <ide> ps.RLock() <ide> func (ps *Store) Get(name, capability string, mode int) (plugingetter.CompatPlug <ide> } <ide> // Plugin was found but it is disabled, so we should not fall back to legacy plugins <ide> // but we should error out right away <del> return nil, ErrNotFound(name) <add> return nil, ErrDisabled(name) <ide> } <ide> if _, ok := errors.Cause(err).(ErrNotFound); !ok { <ide> return nil, err
1
Go
Go
use correct name for apparmor in t.skip()
4ace1998e5e297538139185c69ac7c40929abd18
<ide><path>pkg/sysinfo/sysinfo_linux_test.go <ide> func checkSysInfo(t *testing.T, sysInfo *SysInfo) { <ide> func TestNewAppArmorEnabled(t *testing.T) { <ide> // Check if AppArmor is supported. then it must be TRUE , else FALSE <ide> if _, err := os.Stat("/sys/kernel/security/apparmor"); err != nil { <del> t.Skip("App Armor Must be Enabled") <add> t.Skip("AppArmor Must be Enabled") <ide> } <ide> <ide> sysInfo := New() <ide> func TestNewAppArmorEnabled(t *testing.T) { <ide> func TestNewAppArmorDisabled(t *testing.T) { <ide> // Check if AppArmor is supported. then it must be TRUE , else FALSE <ide> if _, err := os.Stat("/sys/kernel/security/apparmor"); !os.IsNotExist(err) { <del> t.Skip("App Armor Must be Disabled") <add> t.Skip("AppArmor Must be Disabled") <ide> } <ide> <ide> sysInfo := New()
1
Ruby
Ruby
fix rubocop violations
ceadda2e94ca44210a3ed96c3049b59cf06f9f6e
<ide><path>actionpack/test/controller/test_case_test.rb <ide> def test_raw_post_handling <ide> end <ide> <ide> def test_params_round_trip <del> params = {"foo"=>{"contents"=>[{"name"=>"gorby", "id"=>"123"}, {"name"=>"puff", "d"=>"true"}]}} <add> params = { "foo" => { "contents" => [{ "name" => "gorby", "id" => "123" }, { "name" => "puff", "d" => "true" }] } } <ide> post :test_params, params: params.dup <ide> <ide> controller_info = { "controller" => "test_case_test/test", "action" => "test_params" }
1
Javascript
Javascript
remove non-existent entries from inspect
39eb894099f633dc1f3bc82888d4b92e603be679
<ide><path>lib/perf_hooks.js <ide> class PerformanceNodeTiming extends PerformanceEntry { <ide> bootstrapComplete: this.bootstrapComplete, <ide> environment: this.environment, <ide> loopStart: this.loopStart, <del> loopExit: this.loopExit, <del> thirdPartyMainStart: this.thirdPartyMainStart, <del> thirdPartyMainEnd: this.thirdPartyMainEnd, <del> clusterSetupStart: this.clusterSetupStart, <del> clusterSetupEnd: this.clusterSetupEnd, <del> moduleLoadStart: this.moduleLoadStart, <del> moduleLoadEnd: this.moduleLoadEnd, <del> preloadModuleLoadStart: this.preloadModuleLoadStart, <del> preloadModuleLoadEnd: this.preloadModuleLoadEnd <add> loopExit: this.loopExit <ide> }; <ide> } <ide> } <ide><path>test/parallel/test-trace-events-bootstrap.js <ide> const names = [ <ide> 'v8Start', <ide> 'loopStart', <ide> 'loopExit', <del> 'bootstrapComplete', <del> 'thirdPartyMainStart', <del> 'thirdPartyMainEnd', <del> 'clusterSetupStart', <del> 'clusterSetupEnd', <del> 'moduleLoadStart', <del> 'moduleLoadEnd', <del> 'preloadModulesLoadStart', <del> 'preloadModulesLoadEnd' <add> 'bootstrapComplete' <ide> ]; <ide> <ide> if (process.argv[2] === 'child') {
2
PHP
PHP
fix json validator
b0ad3f667b1b9bfbab4a8d6903488acf0194f042
<ide><path>src/Illuminate/Validation/Validator.php <ide> protected function validateString($attribute, $value) <ide> */ <ide> protected function validateJson($attribute, $value) <ide> { <del> return ! is_null(json_decode($value)); <add> json_decode($value); <add> return json_last_error() === JSON_ERROR_NONE; <ide> } <ide> <ide> /**
1
Python
Python
correct an issue on time+ on macos
0d029220dd4cc382590ad5f513832217f9ff9a1e
<ide><path>glances/plugins/glances_processlist.py <ide> def get_process_curses_data(self, p, first, args): <ide> msg = '{:>2}'.format('?') <ide> ret.append(self.curse_add_line(msg)) <ide> # TIME+ <del> if self.tag_proc_time: <del> try: <del> delta = timedelta(seconds=sum(p['cpu_times'])) <del> except (OverflowError, TypeError) as e: <del> # Catch OverflowError on some Amazon EC2 server <del> # See https://github.com/nicolargo/glances/issues/87 <del> # Also catch TypeError on macOS <del> # See: https://github.com/nicolargo/glances/issues/622 <del> logger.debug("Cannot get TIME+ ({})".format(e)) <del> self.tag_proc_time = False <del> else: <del> hours, minutes, seconds, microseconds = convert_timedelta(delta) <del> if hours: <del> msg = '{:>4}h'.format(hours) <del> ret.append(self.curse_add_line(msg, decoration='CPU_TIME', optional=True)) <del> msg = '{}:{}'.format(str(minutes).zfill(2), seconds) <del> else: <del> msg = '{:>4}:{}.{}'.format(minutes, seconds, microseconds) <del> else: <add> try: <add> delta = timedelta(seconds=sum(p['cpu_times'])) <add> except (OverflowError, TypeError) as e: <add> # Catch OverflowError on some Amazon EC2 server <add> # See https://github.com/nicolargo/glances/issues/87 <add> # Also catch TypeError on macOS <add> # See: https://github.com/nicolargo/glances/issues/622 <add> # logger.debug("Cannot get TIME+ ({})".format(e)) <ide> msg = '{:>10}'.format('?') <add> else: <add> hours, minutes, seconds, microseconds = convert_timedelta(delta) <add> if hours: <add> msg = '{:>4}h'.format(hours) <add> ret.append(self.curse_add_line(msg, decoration='CPU_TIME', optional=True)) <add> msg = '{}:{}'.format(str(minutes).zfill(2), seconds) <add> else: <add> msg = '{:>4}:{}.{}'.format(minutes, seconds, microseconds) <ide> ret.append(self.curse_add_line(msg, optional=True)) <ide> # IO read/write <ide> if 'io_counters' in p and p['io_counters'][4] == 1 and p['time_since_update'] != 0:
1
Ruby
Ruby
convert formulary test to spec
8e0940cc2f79def7f19c01dc2a9429cf624f0c6e
<ide><path>Library/Homebrew/test/formulary_spec.rb <add>require "formula" <add>require "formula_installer" <add>require "utils/bottles" <add> <add>describe Formulary do <add> let(:formula_name) { "testball_bottle" } <add> let(:formula_path) { CoreTap.new.formula_dir/"#{formula_name}.rb" } <add> let(:formula_content) do <add> <<-EOS.undent <add> class #{subject.class_s(formula_name)} < Formula <add> url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" <add> sha256 TESTBALL_SHA256 <add> <add> bottle do <add> cellar :any_skip_relocation <add> root_url "file://#{bottle_dir}" <add> sha256 "9abc8ce779067e26556002c4ca6b9427b9874d25f0cafa7028e05b5c5c410cb4" => :#{Utils::Bottles.tag} <add> end <add> <add> def install <add> prefix.install "bin" <add> prefix.install "libexec" <add> end <add> end <add> EOS <add> end <add> let(:bottle_dir) { Pathname.new("#{TEST_FIXTURE_DIR}/bottles") } <add> let(:bottle) { bottle_dir/"testball_bottle-0.1.#{Utils::Bottles.tag}.bottle.tar.gz" } <add> <add> describe "::class_s" do <add> it "replaces '+' with 'x'" do <add> expect(subject.class_s("foo++")).to eq("Fooxx") <add> end <add> <add> it "converts a string to PascalCase" do <add> expect(subject.class_s("shell.fm")).to eq("ShellFm") <add> expect(subject.class_s("s-lang")).to eq("SLang") <add> expect(subject.class_s("pkg-config")).to eq("PkgConfig") <add> expect(subject.class_s("foo_bar")).to eq("FooBar") <add> end <add> <add> it "replaces '@' with 'AT'" do <add> expect(subject.class_s("openssl@1.1")).to eq("OpensslAT11") <add> end <add> end <add> <add> describe "::factory" do <add> before(:each) do <add> formula_path.write formula_content <add> end <add> <add> it "returns a Formula" do <add> expect(subject.factory(formula_name)).to be_kind_of(Formula) <add> end <add> <add> it "returns a Formula when given a fully qualified name" do <add> expect(subject.factory("homebrew/core/#{formula_name}")).to be_kind_of(Formula) <add> end <add> <add> it "raises an error if the Formula cannot be found" do <add> expect { <add> subject.factory("not_existed_formula") <add> }.to raise_error(FormulaUnavailableError) <add> end <add> <add> context "if the Formula has the wrong class" do <add> let(:formula_name) { "giraffe" } <add> let(:formula_content) do <add> <<-EOS.undent <add> class Wrong#{subject.class_s(formula_name)} < Formula <add> end <add> EOS <add> end <add> <add> it "raises an error" do <add> expect { <add> subject.factory(formula_name) <add> }.to raise_error(FormulaClassUnavailableError) <add> end <add> end <add> <add> it "returns a Formula when given a path" do <add> expect(subject.factory(formula_path)).to be_kind_of(Formula) <add> end <add> <add> it "returns a Formula when given a URL" do <add> formula = shutup do <add> subject.factory("file://#{formula_path}") <add> end <add> <add> expect(formula).to be_kind_of(Formula) <add> end <add> <add> it "returns a Formula when given a bottle" do <add> formula = subject.factory(bottle) <add> expect(formula).to be_kind_of(Formula) <add> expect(formula.local_bottle_path).to eq(bottle.realpath) <add> end <add> <add> it "returns a Formula when given an alias" do <add> alias_dir = CoreTap.instance.alias_dir <add> alias_dir.mkpath <add> alias_path = alias_dir/"foo" <add> FileUtils.ln_s formula_path, alias_path <add> result = subject.factory("foo") <add> expect(result).to be_kind_of(Formula) <add> expect(result.alias_path).to eq(alias_path.to_s) <add> end <add> <add> context "with installed Formula" do <add> let(:formula) { subject.factory(formula_path) } <add> let(:installer) { FormulaInstaller.new(formula) } <add> <add> it "returns a Formula when given a rack" do <add> shutup do <add> installer.install <add> end <add> <add> f = subject.from_rack(formula.rack) <add> expect(f).to be_kind_of(Formula) <add> expect(f.build).to be_kind_of(Tab) <add> end <add> <add> it "returns a Formula when given a Keg" do <add> shutup do <add> installer.install <add> end <add> <add> keg = Keg.new(formula.prefix) <add> f = subject.from_keg(keg) <add> expect(f).to be_kind_of(Formula) <add> expect(f.build).to be_kind_of(Tab) <add> end <add> end <add> <add> context "from Tap" do <add> let(:tap) { Tap.new("homebrew", "foo") } <add> let(:formula_path) { tap.path/"#{formula_name}.rb" } <add> <add> it "returns a Formula when given a name" do <add> expect(subject.factory(formula_name)).to be_kind_of(Formula) <add> end <add> <add> it "returns a Formula from an Alias path" do <add> alias_dir = tap.path/"Aliases" <add> alias_dir.mkpath <add> FileUtils.ln_s formula_path, alias_dir/"bar" <add> expect(subject.factory("bar")).to be_kind_of(Formula) <add> end <add> <add> it "raises an error when the Formula cannot be found" do <add> expect { <add> subject.factory("#{tap}/not_existed_formula") <add> }.to raise_error(TapFormulaUnavailableError) <add> end <add> <add> it "returns a Formula when given a fully qualified name" do <add> expect(subject.factory("#{tap}/#{formula_name}")).to be_kind_of(Formula) <add> end <add> <add> it "raises an error if a Formula is in multiple Taps" do <add> begin <add> another_tap = Tap.new("homebrew", "bar") <add> (another_tap.path/"#{formula_name}.rb").write formula_content <add> expect { <add> subject.factory(formula_name) <add> }.to raise_error(TapFormulaAmbiguityError) <add> ensure <add> another_tap.path.rmtree <add> end <add> end <add> end <add> end <add> <add> specify "::from_contents" do <add> expect(subject.from_contents(formula_name, formula_path, formula_content)).to be_kind_of(Formula) <add> end <add> <add> specify "::to_rack" do <add> expect(subject.to_rack(formula_name)).to eq(HOMEBREW_CELLAR/formula_name) <add> <add> (HOMEBREW_CELLAR/formula_name).mkpath <add> expect(subject.to_rack(formula_name)).to eq(HOMEBREW_CELLAR/formula_name) <add> <add> expect { <add> subject.to_rack("a/b/#{formula_name}") <add> }.to raise_error(TapFormulaUnavailableError) <add> end <add> <add> describe "::find_with_priority" do <add> let(:core_path) { CoreTap.new.formula_dir/"#{formula_name}.rb" } <add> let(:tap) { Tap.new("homebrew", "foo") } <add> let(:tap_path) { tap.path/"#{formula_name}.rb" } <add> <add> before(:each) do <add> core_path.write formula_content <add> tap_path.write formula_content <add> end <add> <add> it "prioritizes core Formulae" do <add> formula = subject.find_with_priority(formula_name) <add> expect(formula).to be_kind_of(Formula) <add> expect(formula.path).to eq(core_path) <add> end <add> <add> it "prioritizes Formulae from pinned Taps" do <add> begin <add> tap.pin <add> formula = shutup do <add> subject.find_with_priority(formula_name) <add> end <add> expect(formula).to be_kind_of(Formula) <add> expect(formula.path).to eq(tap_path.realpath) <add> ensure <add> tap.pinned_symlink_path.parent.parent.rmtree <add> end <add> end <add> end <add>end <ide><path>Library/Homebrew/test/formulary_test.rb <del>require "testing_env" <del>require "formula" <del>require "formula_installer" <del>require "utils/bottles" <del> <del>class FormularyTest < Homebrew::TestCase <del> def test_class_naming <del> assert_equal "ShellFm", Formulary.class_s("shell.fm") <del> assert_equal "Fooxx", Formulary.class_s("foo++") <del> assert_equal "SLang", Formulary.class_s("s-lang") <del> assert_equal "PkgConfig", Formulary.class_s("pkg-config") <del> assert_equal "FooBar", Formulary.class_s("foo_bar") <del> assert_equal "OpensslAT11", Formulary.class_s("openssl@1.1") <del> end <del>end <del> <del>class FormularyFactoryTest < Homebrew::TestCase <del> def setup <del> super <del> @name = "testball_bottle" <del> @path = CoreTap.new.formula_dir/"#{@name}.rb" <del> @bottle_dir = Pathname.new("#{TEST_FIXTURE_DIR}/bottles") <del> @bottle = @bottle_dir/"testball_bottle-0.1.#{Utils::Bottles.tag}.bottle.tar.gz" <del> @path.write <<-EOS.undent <del> class #{Formulary.class_s(@name)} < Formula <del> url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" <del> sha256 TESTBALL_SHA256 <del> <del> bottle do <del> cellar :any_skip_relocation <del> root_url "file://#{@bottle_dir}" <del> sha256 "9abc8ce779067e26556002c4ca6b9427b9874d25f0cafa7028e05b5c5c410cb4" => :#{Utils::Bottles.tag} <del> end <del> <del> def install <del> prefix.install "bin" <del> prefix.install "libexec" <del> end <del> end <del> EOS <del> end <del> <del> def test_factory <del> assert_kind_of Formula, Formulary.factory(@name) <del> end <del> <del> def test_factory_with_fully_qualified_name <del> assert_kind_of Formula, Formulary.factory("homebrew/core/#{@name}") <del> end <del> <del> def test_formula_unavailable_error <del> assert_raises(FormulaUnavailableError) { Formulary.factory("not_existed_formula") } <del> end <del> <del> def test_formula_class_unavailable_error <del> name = "giraffe" <del> path = CoreTap.new.formula_dir/"#{name}.rb" <del> path.write "class Wrong#{Formulary.class_s(name)} < Formula\nend\n" <del> <del> assert_raises(FormulaClassUnavailableError) { Formulary.factory(name) } <del> end <del> <del> def test_factory_from_path <del> assert_kind_of Formula, Formulary.factory(@path) <del> end <del> <del> def test_factory_from_url <del> formula = shutup { Formulary.factory("file://#{@path}") } <del> assert_kind_of Formula, formula <del> ensure <del> formula.path.unlink <del> end <del> <del> def test_factory_from_bottle <del> formula = Formulary.factory(@bottle) <del> assert_kind_of Formula, formula <del> assert_equal @bottle.realpath, formula.local_bottle_path <del> end <del> <del> def test_factory_from_alias <del> alias_dir = CoreTap.instance.alias_dir <del> alias_dir.mkpath <del> alias_path = alias_dir/"foo" <del> FileUtils.ln_s @path, alias_path <del> result = Formulary.factory("foo") <del> assert_kind_of Formula, result <del> assert_equal alias_path.to_s, result.alias_path <del> end <del> <del> def test_factory_from_rack_and_from_keg <del> formula = Formulary.factory(@path) <del> installer = FormulaInstaller.new(formula) <del> shutup { installer.install } <del> keg = Keg.new(formula.prefix) <del> f = Formulary.from_rack(formula.rack) <del> assert_kind_of Formula, f <del> assert_kind_of Tab, f.build <del> f = Formulary.from_keg(keg) <del> assert_kind_of Formula, f <del> assert_kind_of Tab, f.build <del> ensure <del> keg.unlink <del> end <del> <del> def test_load_from_contents <del> assert_kind_of Formula, Formulary.from_contents(@name, @path, @path.read) <del> end <del> <del> def test_to_rack <del> assert_equal HOMEBREW_CELLAR/@name, Formulary.to_rack(@name) <del> (HOMEBREW_CELLAR/@name).mkpath <del> assert_equal HOMEBREW_CELLAR/@name, Formulary.to_rack(@name) <del> assert_raises(TapFormulaUnavailableError) { Formulary.to_rack("a/b/#{@name}") } <del> end <del>end <del> <del>class FormularyTapFactoryTest < Homebrew::TestCase <del> def setup <del> super <del> @name = "foo" <del> @tap = Tap.new "homebrew", "foo" <del> @path = @tap.path/"#{@name}.rb" <del> @code = <<-EOS.undent <del> class #{Formulary.class_s(@name)} < Formula <del> url "foo-1.0" <del> end <del> EOS <del> @path.write @code <del> end <del> <del> def test_factory_tap_formula <del> assert_kind_of Formula, Formulary.factory(@name) <del> end <del> <del> def test_factory_tap_alias <del> alias_dir = @tap.path/"Aliases" <del> alias_dir.mkpath <del> FileUtils.ln_s @path, alias_dir/"bar" <del> assert_kind_of Formula, Formulary.factory("bar") <del> end <del> <del> def test_tap_formula_unavailable_error <del> assert_raises(TapFormulaUnavailableError) { Formulary.factory("#{@tap}/not_existed_formula") } <del> end <del> <del> def test_factory_tap_formula_with_fully_qualified_name <del> assert_kind_of Formula, Formulary.factory("#{@tap}/#{@name}") <del> end <del> <del> def test_factory_ambiguity_tap_formulae <del> another_tap = Tap.new "homebrew", "bar" <del> (another_tap.path/"#{@name}.rb").write @code <del> assert_raises(TapFormulaAmbiguityError) { Formulary.factory(@name) } <del> ensure <del> another_tap.path.rmtree <del> end <del>end <del> <del>class FormularyTapPriorityTest < Homebrew::TestCase <del> def setup <del> super <del> @name = "foo" <del> @core_path = CoreTap.new.formula_dir/"#{@name}.rb" <del> @tap = Tap.new "homebrew", "foo" <del> @tap_path = @tap.path/"#{@name}.rb" <del> code = <<-EOS.undent <del> class #{Formulary.class_s(@name)} < Formula <del> url "foo-1.0" <del> end <del> EOS <del> @core_path.write code <del> @tap_path.write code <del> end <del> <del> def test_find_with_priority_core_formula <del> formula = Formulary.find_with_priority(@name) <del> assert_kind_of Formula, formula <del> assert_equal @core_path, formula.path <del> end <del> <del> def test_find_with_priority_tap_formula <del> @tap.pin <del> formula = shutup { Formulary.find_with_priority(@name) } <del> assert_kind_of Formula, formula <del> assert_equal @tap_path.realpath, formula.path <del> ensure <del> @tap.pinned_symlink_path.parent.parent.rmtree <del> end <del>end
2
Java
Java
add jackson @jsonview support
6cda08e94b9ba72da2334733443aefd2462c8755
<ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/config/WebReactiveConfiguration.java <ide> import org.springframework.web.reactive.handler.AbstractHandlerMapping; <ide> import org.springframework.web.reactive.result.SimpleHandlerAdapter; <ide> import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver; <add>import org.springframework.http.codec.Jackson2ServerHttpMessageReader; <add>import org.springframework.http.codec.Jackson2ServerHttpMessageWriter; <ide> import org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter; <ide> import org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerMapping; <ide> import org.springframework.web.reactive.result.method.annotation.ResponseBodyResultHandler; <ide> protected final void addDefaultHttpMessageReaders(List<HttpMessageReader<?>> rea <ide> readers.add(new DecoderHttpMessageReader<>(new Jaxb2XmlDecoder())); <ide> } <ide> if (jackson2Present) { <del> readers.add(new DecoderHttpMessageReader<>(new Jackson2JsonDecoder())); <add> readers.add(new Jackson2ServerHttpMessageReader(new DecoderHttpMessageReader<>(new Jackson2JsonDecoder()))); <ide> } <ide> } <ide> <ide> protected final void addDefaultHttpMessageWriters(List<HttpMessageWriter<?>> wri <ide> } <ide> if (jackson2Present) { <ide> Jackson2JsonEncoder jacksonEncoder = new Jackson2JsonEncoder(); <del> writers.add(new EncoderHttpMessageWriter<>(jacksonEncoder)); <add> writers.add(new Jackson2ServerHttpMessageWriter(new EncoderHttpMessageWriter<>(jacksonEncoder))); <ide> sseDataEncoders.add(jacksonEncoder); <ide> } <del> writers.add(new ServerSentEventHttpMessageWriter(sseDataEncoders)); <add> writers.add(new Jackson2ServerHttpMessageWriter(new ServerSentEventHttpMessageWriter(sseDataEncoders))); <ide> } <ide> /** <ide> * Override this to modify the list of message writers after it has been <ide><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/JacksonHintsIntegrationTests.java <add>/* <add> * Copyright 2002-2016 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.web.reactive.result.method.annotation; <add> <add>import java.util.Arrays; <add>import java.util.List; <add> <add>import com.fasterxml.jackson.annotation.JsonView; <add>import static org.junit.Assert.assertEquals; <add>import org.junit.Test; <add>import reactor.core.publisher.Flux; <add>import reactor.core.publisher.Mono; <add> <add>import org.springframework.context.ApplicationContext; <add>import org.springframework.context.annotation.AnnotationConfigApplicationContext; <add>import org.springframework.context.annotation.ComponentScan; <add>import org.springframework.context.annotation.Configuration; <add>import org.springframework.http.MediaType; <add>import org.springframework.web.bind.annotation.GetMapping; <add>import org.springframework.web.bind.annotation.PostMapping; <add>import org.springframework.web.bind.annotation.RequestBody; <add>import org.springframework.web.bind.annotation.RestController; <add>import org.springframework.web.reactive.config.WebReactiveConfiguration; <add> <add>/** <add> * @author Sebastien Deleuze <add> */ <add>public class JacksonHintsIntegrationTests extends AbstractRequestMappingIntegrationTests { <add> <add> @Override <add> protected ApplicationContext initApplicationContext() { <add> AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext(); <add> wac.register(WebConfig.class); <add> wac.refresh(); <add> return wac; <add> } <add> <add> @Test <add> public void jsonViewResponse() throws Exception { <add> String expected = "{\"withView1\":\"with\"}"; <add> assertEquals(expected, performGet("/response/raw", MediaType.APPLICATION_JSON_UTF8, String.class).getBody()); <add> } <add> <add> @Test <add> public void jsonViewWithMonoResponse() throws Exception { <add> String expected = "{\"withView1\":\"with\"}"; <add> assertEquals(expected, performGet("/response/mono", MediaType.APPLICATION_JSON_UTF8, String.class).getBody()); <add> } <add> <add> @Test <add> public void jsonViewWithFluxResponse() throws Exception { <add> String expected = "[{\"withView1\":\"with\"},{\"withView1\":\"with\"}]"; <add> assertEquals(expected, performGet("/response/flux", MediaType.APPLICATION_JSON_UTF8, String.class).getBody()); <add> } <add> <add> @Test <add> public void jsonViewWithRequest() throws Exception { <add> String expected = "{\"withView1\":\"with\",\"withView2\":null,\"withoutView\":null}"; <add> assertEquals(expected, performPost("/request/raw", MediaType.APPLICATION_JSON, <add> new JacksonViewBean("with", "with", "without"), MediaType.APPLICATION_JSON_UTF8, String.class).getBody()); <add> } <add> <add> @Test <add> public void jsonViewWithMonoRequest() throws Exception { <add> String expected = "{\"withView1\":\"with\",\"withView2\":null,\"withoutView\":null}"; <add> assertEquals(expected, performPost("/request/mono", MediaType.APPLICATION_JSON, <add> new JacksonViewBean("with", "with", "without"), MediaType.APPLICATION_JSON_UTF8, String.class).getBody()); <add> } <add> <add> @Test <add> public void jsonViewWithFluxRequest() throws Exception { <add> String expected = "[{\"withView1\":\"with\",\"withView2\":null,\"withoutView\":null}," + <add> "{\"withView1\":\"with\",\"withView2\":null,\"withoutView\":null}]"; <add> List<JacksonViewBean> beans = Arrays.asList(new JacksonViewBean("with", "with", "without"), new JacksonViewBean("with", "with", "without")); <add> assertEquals(expected, performPost("/request/flux", MediaType.APPLICATION_JSON, beans, <add> MediaType.APPLICATION_JSON_UTF8, String.class).getBody()); <add> } <add> <add> <add> @Configuration <add> @ComponentScan(resourcePattern = "**/JacksonHintsIntegrationTests*.class") <add> @SuppressWarnings({"unused", "WeakerAccess"}) <add> static class WebConfig extends WebReactiveConfiguration { <add> } <add> <add> @RestController <add> @SuppressWarnings("unused") <add> private static class JsonViewRestController { <add> <add> @GetMapping("/response/raw") <add> @JsonView(MyJacksonView1.class) <add> public JacksonViewBean rawResponse() { <add> return new JacksonViewBean("with", "with", "without"); <add> } <add> <add> @GetMapping("/response/mono") <add> @JsonView(MyJacksonView1.class) <add> public Mono<JacksonViewBean> monoResponse() { <add> return Mono.just(new JacksonViewBean("with", "with", "without")); <add> } <add> <add> @GetMapping("/response/flux") <add> @JsonView(MyJacksonView1.class) <add> public Flux<JacksonViewBean> fluxResponse() { <add> return Flux.just(new JacksonViewBean("with", "with", "without"), new JacksonViewBean("with", "with", "without")); <add> } <add> <add> @PostMapping("/request/raw") <add> public JacksonViewBean rawRequest(@JsonView(MyJacksonView1.class) @RequestBody JacksonViewBean bean) { <add> return bean; <add> } <add> <add> @PostMapping("/request/mono") <add> public Mono<JacksonViewBean> monoRequest(@JsonView(MyJacksonView1.class) @RequestBody Mono<JacksonViewBean> mono) { <add> return mono; <add> } <add> <add> @PostMapping("/request/flux") <add> public Flux<JacksonViewBean> fluxRequest(@JsonView(MyJacksonView1.class) @RequestBody Flux<JacksonViewBean> flux) { <add> return flux; <add> } <add> <add> } <add> <add> private interface MyJacksonView1 {} <add> <add> private interface MyJacksonView2 {} <add> <add> <add> @SuppressWarnings("unused") <add> private static class JacksonViewBean { <add> <add> @JsonView(MyJacksonView1.class) <add> private String withView1; <add> <add> @JsonView(MyJacksonView2.class) <add> private String withView2; <add> <add> private String withoutView; <add> <add> <add> public JacksonViewBean() { <add> } <add> <add> public JacksonViewBean(String withView1, String withView2, String withoutView) { <add> this.withView1 = withView1; <add> this.withView2 = withView2; <add> this.withoutView = withoutView; <add> } <add> <add> public String getWithView1() { <add> return withView1; <add> } <add> <add> public void setWithView1(String withView1) { <add> this.withView1 = withView1; <add> } <add> <add> public String getWithView2() { <add> return withView2; <add> } <add> <add> public void setWithView2(String withView2) { <add> this.withView2 = withView2; <add> } <add> <add> public String getWithoutView() { <add> return withoutView; <add> } <add> <add> public void setWithoutView(String withoutView) { <add> this.withoutView = withoutView; <add> } <add> } <add> <add>} <ide>\ No newline at end of file <ide><path>spring-web/src/main/java/org/springframework/http/codec/Jackson2ServerHttpMessageReader.java <add>/* <add> * Copyright 2002-2016 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.http.codec; <add> <add>import java.util.Collections; <add>import java.util.Map; <add> <add>import com.fasterxml.jackson.annotation.JsonView; <add> <add>import org.springframework.core.MethodParameter; <add>import org.springframework.core.ResolvableType; <add>import org.springframework.http.MediaType; <add>import org.springframework.http.codec.json.AbstractJackson2Codec; <add>import org.springframework.http.server.reactive.ServerHttpRequest; <add> <add>/** <add> * {@link ServerHttpMessageReader} that resolves those annotation or request based Jackson 2 hints: <add> * <ul> <add> * <li>{@code @JsonView} + {@code @RequestBody} annotated handler method parameter</li> <add> * </ul> <add> * <add> * @author Sebastien Deleuze <add> * @since 5.0 <add> * @see com.fasterxml.jackson.annotation.JsonView <add> */ <add>public class Jackson2ServerHttpMessageReader extends AbstractServerHttpMessageReader<Object> { <add> <add> public Jackson2ServerHttpMessageReader(HttpMessageReader<Object> reader) { <add> super(reader); <add> } <add> <add> @Override <add> protected Map<String, Object> resolveReadHintsInternal(ResolvableType streamType, <add> ResolvableType elementType, MediaType mediaType, ServerHttpRequest request) { <add> <add> Object source = streamType.getSource(); <add> MethodParameter parameter = (source instanceof MethodParameter ? (MethodParameter)source : null); <add> if (parameter != null) { <add> JsonView annotation = parameter.getParameterAnnotation(JsonView.class); <add> if (annotation != null) { <add> Class<?>[] classes = annotation.value(); <add> if (classes.length != 1) { <add> throw new IllegalArgumentException( <add> "@JsonView only supported for read hints with exactly 1 class argument: " + parameter); <add> } <add> return Collections.singletonMap(AbstractJackson2Codec.JSON_VIEW_HINT, classes[0]); <add> } <add> } <add> return Collections.emptyMap(); <add> } <add> <add>} <ide><path>spring-web/src/main/java/org/springframework/http/codec/Jackson2ServerHttpMessageWriter.java <add>/* <add> * Copyright 2002-2016 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.http.codec; <add> <add>import java.util.Collections; <add>import java.util.Map; <add> <add>import com.fasterxml.jackson.annotation.JsonView; <add> <add>import org.springframework.core.MethodParameter; <add>import org.springframework.core.ResolvableType; <add>import org.springframework.http.MediaType; <add>import org.springframework.http.codec.json.AbstractJackson2Codec; <add>import org.springframework.http.server.reactive.ServerHttpRequest; <add> <add>/** <add> * {@link ServerHttpMessageWriter} that resolves those annotation or request based Jackson 2 hints: <add> * <ul> <add> * <li>{@code @JsonView} annotated handler method</li> <add> * </ul> <add> * <add> * @author Sebastien Deleuze <add> * @since 5.0 <add> * @see com.fasterxml.jackson.annotation.JsonView <add> */ <add>public class Jackson2ServerHttpMessageWriter extends AbstractServerHttpMessageWriter<Object> { <add> <add> public Jackson2ServerHttpMessageWriter(HttpMessageWriter<Object> writer) { <add> super(writer); <add> } <add> <add> @Override <add> protected Map<String, Object> resolveWriteHintsInternal(ResolvableType streamType, <add> ResolvableType elementType, MediaType mediaType, ServerHttpRequest request) { <add> <add> Object source = streamType.getSource(); <add> MethodParameter returnValue = (source instanceof MethodParameter ? (MethodParameter)source : null); <add> if (returnValue != null) { <add> JsonView annotation = returnValue.getMethodAnnotation(JsonView.class); <add> if (annotation != null) { <add> Class<?>[] classes = annotation.value(); <add> if (classes.length != 1) { <add> throw new IllegalArgumentException( <add> "@JsonView only supported for write hints with exactly 1 class argument: " + returnValue); <add> } <add> return Collections.singletonMap(AbstractJackson2Codec.JSON_VIEW_HINT, classes[0]); <add> } <add> } <add> return Collections.emptyMap(); <add> } <add> <add>}
4
Ruby
Ruby
fix broken generators test
9106318fdf1f4f23548fe03d5e1d5e4ebe35f45e
<ide><path>railties/test/generators/app_generator_test.rb <ide> def test_dev_option <ide> <ide> def test_edge_option <ide> assert_generates_with_bundler edge: true <del> assert_file "Gemfile", %r{^gem\s+["']rails["'],\s+github:\s+["']#{Regexp.escape("rails/rails")}["'],\s+branch:\s+["']#{Regexp.escape("5-0-stable")}["']$} <add> assert_file "Gemfile", %r{^gem\s+["']rails["'],\s+github:\s+["']#{Regexp.escape("rails/rails")}["']$} <ide> end <ide> <ide> def test_spring <ide><path>railties/test/generators/plugin_generator_test.rb <ide> def test_dev_option <ide> <ide> def test_edge_option <ide> assert_generates_without_bundler(edge: true) <del> assert_file "Gemfile", %r{^gem\s+["']rails["'],\s+github:\s+["']#{Regexp.escape("rails/rails")}["'],\s+branch:\s+["']#{Regexp.escape("5-0-stable")}["']$} <add> assert_file "Gemfile", %r{^gem\s+["']rails["'],\s+github:\s+["']#{Regexp.escape("rails/rails")}["']$} <ide> end <ide> <ide> def test_generation_does_not_run_bundle_install_with_full_and_mountable
2
Text
Text
remove duplicate properties bullet in readme
4424e847d5e1e74c701fcba300cbe42480c53aee
<ide><path>tools/doc/README.md <ide> This event is emitted on instances of SomeClass, not on the module itself. <ide> ``` <ide> <ide> <del>* Modules have (description, Properties, Functions, Classes, Examples) <del>* Properties have (type, description) <del>* Functions have (list of arguments, description) <ide> * Classes have (description, Properties, Methods, Events) <ide> * Events have (list of arguments, description) <add>* Functions have (list of arguments, description) <ide> * Methods have (list of arguments, description) <add>* Modules have (description, Properties, Functions, Classes, Examples) <ide> * Properties have (type, description)
1
PHP
PHP
add types to error package classes
7d1e0694ce0db8f04a79c4a89edd2dd804ad65d1
<ide><path>src/Error/BaseErrorHandler.php <ide> use Cake\Routing\Router; <ide> use Error; <ide> use Exception; <add>use Throwable; <ide> <ide> /** <ide> * Base error handler that provides logic common to the CLI + web <ide> abstract class BaseErrorHandler <ide> * @param bool $debug Whether or not the app is in debug mode. <ide> * @return void <ide> */ <del> abstract protected function _displayError($error, $debug); <add> abstract protected function _displayError(array $error, bool $debug): void; <ide> <ide> /** <ide> * Display an exception in an environment specific way. <ide> * <ide> * Subclasses should implement this method to display an uncaught exception as <ide> * desired for the runtime they operate in. <ide> * <del> * @param \Exception $exception The uncaught exception. <add> * @param \Throwable $exception The uncaught exception. <ide> * @return void <ide> */ <del> abstract protected function _displayException($exception); <add> abstract protected function _displayException(Throwable $exception): void; <ide> <ide> /** <ide> * Register the error and exception handlers. <ide> * <ide> * @return void <ide> */ <del> public function register() <add> public function register(): void <ide> { <ide> $level = -1; <ide> if (isset($this->_options['errorLevel'])) { <ide> $level = $this->_options['errorLevel']; <ide> } <ide> error_reporting($level); <ide> set_error_handler([$this, 'handleError'], $level); <del> set_exception_handler([$this, 'wrapAndHandleException']); <add> set_exception_handler([$this, 'handleException']); <ide> register_shutdown_function(function () { <ide> if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') && $this->_handled) { <ide> return; <ide> public function register() <ide> * @param array|null $context Context <ide> * @return bool True if error was handled <ide> */ <del> public function handleError($code, $description, $file = null, $line = null, $context = null) <add> public function handleError(int $code, string $description, ?string $file = null, ?int $line = null, ?array $context = null): bool <ide> { <ide> if (error_reporting() === 0) { <ide> return false; <ide> public function handleError($code, $description, $file = null, $line = null, $co <ide> * then, it wraps the passed object inside another Exception object <ide> * for backwards compatibility purposes. <ide> * <del> * @param \Exception|\Error $exception The exception to handle <add> * @param \Throwable $exception The exception to handle <ide> * @return void <add> * @deprecated 4.0.0 Unused method will be removed in 5.0 <ide> */ <del> public function wrapAndHandleException($exception) <add> public function wrapAndHandleException(Throwable $exception): void <ide> { <del> if ($exception instanceof Error) { <del> $exception = new PHP7ErrorException($exception); <del> } <add> deprecationWarning('This method is no longer in use. Call handleException instead.'); <ide> $this->handleException($exception); <ide> } <ide> <ide> public function wrapAndHandleException($exception) <ide> * Uses a template method provided by subclasses to display errors in an <ide> * environment appropriate way. <ide> * <del> * @param \Exception $exception Exception instance. <add> * @param \Throwable $exception Exception instance. <ide> * @return void <ide> * @throws \Exception When renderer class not found <ide> * @see https://secure.php.net/manual/en/function.set-exception-handler.php <ide> */ <del> public function handleException(Exception $exception) <add> public function handleException(Throwable $exception): void <ide> { <ide> $this->_displayException($exception); <ide> $this->_logException($exception); <ide> protected function _stop($code) <ide> * @param int $line Line that triggered the error <ide> * @return bool <ide> */ <del> public function handleFatalError($code, $description, $file, $line) <add> public function handleFatalError(int $code, string $description, string $file, int $line): bool <ide> { <ide> $data = [ <ide> 'code' => $code, <ide> public function handleFatalError($code, $description, $file, $line) <ide> * @param int $additionalKb Number in kilobytes <ide> * @return void <ide> */ <del> public function increaseMemoryLimit($additionalKb) <add> public function increaseMemoryLimit(int $additionalKb): void <ide> { <ide> $limit = ini_get('memory_limit'); <ide> if (!strlen($limit) || $limit === '-1') { <ide> public function increaseMemoryLimit($additionalKb) <ide> /** <ide> * Log an error. <ide> * <del> * @param string $level The level name of the log. <add> * @param int|string $level The level name of the log. <ide> * @param array $data Array of error data. <ide> * @return bool <ide> */ <del> protected function _logError($level, $data) <add> protected function _logError($level, array $data): bool <ide> { <ide> $message = sprintf( <ide> '%s (%s): %s in [%s, line %s]', <ide> protected function _logError($level, $data) <ide> /** <ide> * Handles exception logging <ide> * <del> * @param \Exception $exception Exception instance. <add> * @param \Throwable $exception Exception instance. <ide> * @return bool <ide> */ <del> protected function _logException(Exception $exception) <add> protected function _logException(Throwable $exception): bool <ide> { <ide> $config = $this->_options; <ide> $unwrapped = $exception instanceof PHP7ErrorException ? <ide> protected function _logException(Exception $exception) <ide> * @param \Cake\Http\ServerRequest $request The request to read from. <ide> * @return string <ide> */ <del> protected function _requestContext($request) <add> protected function _requestContext($request): string <ide> { <ide> $message = "\nRequest URL: " . $request->getRequestTarget(); <ide> <ide> protected function _requestContext($request) <ide> /** <ide> * Generates a formatted error message <ide> * <del> * @param \Exception $exception Exception instance <add> * @param \Throwable $exception Exception instance <ide> * @return string Formatted message <ide> */ <del> protected function _getMessage(Exception $exception) <add> protected function _getMessage(Throwable $exception): string <ide> { <ide> $exception = $exception instanceof PHP7ErrorException ? <ide> $exception->getError() : <ide> protected function _getMessage(Exception $exception) <ide> * @param int $code Error code to map <ide> * @return array Array of error word, and log location. <ide> */ <del> public static function mapErrorCode($code) <add> public static function mapErrorCode(int $code): array <ide> { <ide> $levelMap = [ <ide> E_PARSE => 'error', <ide><path>src/Error/Debugger.php <ide> public function __construct() <ide> * @param string|null $class Class name. <ide> * @return \Cake\Error\Debugger <ide> */ <del> public static function getInstance($class = null) <add> public static function getInstance(?string $class = null) <ide> { <ide> static $instance = []; <ide> if (!empty($class)) { <ide> public static function configInstance($key = null, $value = null, $merge = true) <ide> * <ide> * @return array <ide> */ <del> public static function outputMask() <add> public static function outputMask(): array <ide> { <ide> return static::configInstance('outputMask'); <ide> } <ide> public static function outputMask() <ide> * @param bool $merge Whether to recursively merge or overwrite existing config, defaults to true. <ide> * @return void <ide> */ <del> public static function setOutputMask(array $value, $merge = true) <add> public static function setOutputMask(array $value, bool $merge = true): void <ide> { <ide> static::configInstance('outputMask', $value, $merge); <ide> } <ide> public static function setOutputMask(array $value, $merge = true) <ide> * @see \Cake\Error\Debugger::exportVar() <ide> * @link https://book.cakephp.org/3.0/en/development/debugging.html#outputting-values <ide> */ <del> public static function dump($var, $depth = 3) <add> public static function dump($var, int $depth = 3): void <ide> { <ide> pr(static::exportVar($var, $depth)); <ide> } <ide> public static function dump($var, $depth = 3) <ide> * @param int $depth The depth to output to. Defaults to 3. <ide> * @return void <ide> */ <del> public static function log($var, $level = 'debug', $depth = 3) <add> public static function log($var, $level = 'debug', int $depth = 3): void <ide> { <ide> $source = static::trace(['start' => 1]) . "\n"; <ide> Log::write($level, "\n" . $source . static::exportVar($var, $depth)); <ide> public static function formatTrace($backtrace, array $options = []) <ide> * @param string $path Path to shorten. <ide> * @return string Normalized path <ide> */ <del> public static function trimPath($path) <add> public static function trimPath(string $path): string <ide> { <ide> if (defined('APP') && strpos($path, APP) === 0) { <ide> return str_replace(APP, 'APP/', $path); <ide> public static function trimPath($path) <ide> * @see https://secure.php.net/highlight_string <ide> * @link https://book.cakephp.org/3.0/en/development/debugging.html#getting-an-excerpt-from-a-file <ide> */ <del> public static function excerpt($file, $line, $context = 2) <add> public static function excerpt(string $file, int $line, int $context = 2): array <ide> { <ide> $lines = []; <ide> if (!file_exists($file)) { <ide> public static function excerpt($file, $line, $context = 2) <ide> * @param string $str The string to convert. <ide> * @return string <ide> */ <del> protected static function _highlight($str) <add> protected static function _highlight(string $str): string <ide> { <ide> if (function_exists('hphp_log') || function_exists('hphp_gettid')) { <ide> return htmlentities($str); <ide> protected static function _highlight($str) <ide> * @param int $depth The depth to output to. Defaults to 3. <ide> * @return string Variable as a formatted string <ide> */ <del> public static function exportVar($var, $depth = 3) <add> public static function exportVar($var, int $depth = 3): string <ide> { <ide> return static::_export($var, $depth, 0); <ide> } <ide> public static function exportVar($var, $depth = 3) <ide> * @param int $indent The current indentation level. <ide> * @return string The dumped variable. <ide> */ <del> protected static function _export($var, $depth, $indent) <add> protected static function _export($var, int $depth, int $indent): string <ide> { <ide> switch (static::getType($var)) { <ide> case 'boolean': <ide> protected static function _export($var, $depth, $indent) <ide> * @param int $indent The current indentation level. <ide> * @return string Exported array. <ide> */ <del> protected static function _array(array $var, $depth, $indent) <add> protected static function _array(array $var, int $depth, int $indent): string <ide> { <ide> $out = '['; <ide> $break = $end = null; <ide> protected static function _array(array $var, $depth, $indent) <ide> * @return string <ide> * @see \Cake\Error\Debugger::exportVar() <ide> */ <del> protected static function _object($var, $depth, $indent) <add> protected static function _object($var, int $depth, int $indent): string <ide> { <ide> $out = ''; <ide> $props = []; <ide> protected static function _object($var, $depth, $indent) <ide> * <ide> * @return string Returns the current format when getting. <ide> */ <del> public static function getOutputFormat() <add> public static function getOutputFormat(): string <ide> { <ide> return Debugger::getInstance()->_outputFormat; <ide> } <ide> public static function getOutputFormat() <ide> * @return void <ide> * @throws \InvalidArgumentException When choosing a format that doesn't exist. <ide> */ <del> public static function setOutputFormat($format) <add> public static function setOutputFormat(string $format): void <ide> { <ide> $self = Debugger::getInstance(); <ide> <ide> public static function setOutputFormat($format) <ide> * @param array $strings Template strings, or a callback to be used for the output format. <ide> * @return array The resulting format string set. <ide> */ <del> public static function addFormat($format, array $strings) <add> public static function addFormat(string $format, array $strings): array <ide> { <ide> $self = Debugger::getInstance(); <ide> if (isset($self->_templates[$format])) { <ide> public static function addFormat($format, array $strings) <ide> * @param array $data Data to output. <ide> * @return void <ide> */ <del> public function outputError($data) <add> public function outputError(array $data): void <ide> { <ide> $defaults = [ <ide> 'level' => 0, <ide> public function outputError($data) <ide> * @param mixed $var The variable to get the type of. <ide> * @return string The type of variable. <ide> */ <del> public static function getType($var) <add> public static function getType($var): string <ide> { <ide> if (is_object($var)) { <ide> return get_class($var); <ide> public static function getType($var) <ide> * data in a browser-friendly way. <ide> * @return void <ide> */ <del> public static function printVar($var, $location = [], $showHtml = null) <add> public static function printVar($var, array $location = [], ?bool $showHtml = null): void <ide> { <ide> $location += ['file' => null, 'line' => null]; <ide> $file = $location['file']; <ide><path>src/Error/ErrorHandler.php <ide> public function __construct($options = []) <ide> * @param bool $debug Whether or not the app is in debug mode. <ide> * @return void <ide> */ <del> protected function _displayError($error, $debug) <add> protected function _displayError(array $error, bool $debug): void <ide> { <ide> if (!$debug) { <ide> return; <ide> protected function _displayError($error, $debug) <ide> * @return void <ide> * @throws \Exception When the chosen exception renderer is invalid. <ide> */ <del> protected function _displayException($exception) <add> protected function _displayException(Throwable $exception): void <ide> { <ide> $rendererClassName = App::className($this->_options['exceptionRenderer'], 'Error'); <ide> try { <ide> protected function _displayException($exception) <ide> * <ide> * @return void <ide> */ <del> protected function _clearOutput() <add> protected function _clearOutput(): void <ide> { <ide> while (ob_get_level()) { <ide> ob_end_clean(); <ide> protected function _clearOutput() <ide> * <ide> * The PHP5 part will be removed with 4.0. <ide> * <del> * @param \Throwable|\Exception $exception Exception. <del> * <add> * @param \Throwable $exception Exception. <ide> * @return void <ide> */ <del> protected function _logInternalError($exception) <add> protected function _logInternalError(Throwable $exception): void <ide> { <ide> // Disable trace for internal errors. <ide> $this->_options['trace'] = false; <ide> protected function _logInternalError($exception) <ide> * @param string|\Cake\Http\Response $response Either the message or response object. <ide> * @return void <ide> */ <del> protected function _sendResponse($response) <add> protected function _sendResponse($response): void <ide> { <ide> if (is_string($response)) { <ide> echo $response; <ide><path>src/Error/ExceptionRenderer.php <ide> use Cake\View\Exception\MissingTemplateException; <ide> use Exception; <ide> use PDOException; <add>use Psr\Http\Message\ResponseInterface; <ide> use Psr\Http\Message\ServerRequestInterface; <add>use Throwable; <ide> <ide> /** <ide> * Exception Renderer. <ide> class ExceptionRenderer implements ExceptionRendererInterface <ide> /** <ide> * The exception being handled. <ide> * <del> * @var \Exception <add> * @var \Throwable <ide> */ <ide> public $error; <ide> <ide> class ExceptionRenderer implements ExceptionRendererInterface <ide> * If the error is a Cake\Core\Exception\Exception it will be converted to either a 400 or a 500 <ide> * code error depending on the code used to construct the error. <ide> * <del> * @param \Exception $exception Exception. <add> * @param \Throwable $exception Exception. <ide> * @param \Psr\Http\Message\ServerRequestInterface $request The request - if this is set it will be used instead of creating a new one <ide> */ <del> public function __construct(Exception $exception, ServerRequestInterface $request = null) <add> public function __construct(Throwable $exception, ServerRequestInterface $request = null) <ide> { <ide> $this->error = $exception; <ide> $this->request = $request; <ide> $this->controller = $this->_getController(); <ide> } <ide> <del> /** <del> * Returns the unwrapped exception object in case we are dealing with <del> * a PHP 7 Error object <del> * <del> * @param \Exception $exception The object to unwrap <del> * @return \Exception|\Error <del> */ <del> protected function _unwrap($exception) <del> { <del> return $exception instanceof PHP7ErrorException ? $exception->getError() : $exception; <del> } <del> <ide> /** <ide> * Get the controller instance to handle the exception. <ide> * Override this method in subclasses to customize the controller used. <ide> protected function _getController() <ide> $controller = new $class($request, $response); <ide> $controller->startupProcess(); <ide> $startup = true; <del> } catch (Exception $e) { <add> } catch (Throwable $e) { <ide> $startup = false; <ide> } <ide> <ide> protected function _getController() <ide> try { <ide> $event = new Event('Controller.startup', $controller); <ide> $controller->RequestHandler->startup($event); <del> } catch (Exception $e) { <add> } catch (Throwable $e) { <ide> } <ide> } <ide> if (empty($controller)) { <ide> protected function _getController() <ide> * <ide> * @return \Cake\Http\Response The response to be sent. <ide> */ <del> public function render() <add> public function render(): ResponseInterface <ide> { <ide> $exception = $this->error; <ide> $code = $this->_code($exception); <ide> $method = $this->_method($exception); <ide> $template = $this->_template($exception, $method, $code); <del> $unwrapped = $this->_unwrap($exception); <ide> <ide> $isDebug = Configure::read('debug'); <ide> if (($isDebug || $exception instanceof HttpException) && <ide> method_exists($this, $method) <ide> ) { <del> return $this->_customMethod($method, $unwrapped); <add> return $this->_customMethod($method, $exception); <ide> } <ide> <ide> $message = $this->_message($exception, $code); <ide> public function render() <ide> $viewVars = [ <ide> 'message' => $message, <ide> 'url' => h($url), <del> 'error' => $unwrapped, <add> 'error' => $exception, <ide> 'code' => $code, <ide> '_serialize' => ['message', 'url', 'code'] <ide> ]; <ide> if ($isDebug) { <del> $viewVars['trace'] = Debugger::formatTrace($unwrapped->getTrace(), [ <add> $viewVars['trace'] = Debugger::formatTrace($exception->getTrace(), [ <ide> 'format' => 'array', <ide> 'args' => false <ide> ]); <ide> public function render() <ide> } <ide> $this->controller->set($viewVars); <ide> <del> if ($unwrapped instanceof CakeException && $isDebug) { <del> $this->controller->set($unwrapped->getAttributes()); <add> if ($exception instanceof CakeException && $isDebug) { <add> $this->controller->set($exception->getAttributes()); <ide> } <ide> $this->controller->setResponse($response); <ide> <ide> public function render() <ide> * Render a custom error method/template. <ide> * <ide> * @param string $method The method name to invoke. <del> * @param \Exception $exception The exception to render. <add> * @param \Throwable $exception The exception to render. <ide> * @return \Cake\Http\Response The response to send. <ide> */ <del> protected function _customMethod($method, $exception) <add> protected function _customMethod(string $method, Throwable $exception) <ide> { <ide> $result = call_user_func([$this, $method], $exception); <ide> $this->_shutdown(); <ide> protected function _customMethod($method, $exception) <ide> /** <ide> * Get method name <ide> * <del> * @param \Exception $exception Exception instance. <add> * @param \Throwable $exception Exception instance. <ide> * @return string <ide> */ <del> protected function _method(Exception $exception) <add> protected function _method(Throwable $exception) <ide> { <del> $exception = $this->_unwrap($exception); <ide> list(, $baseClass) = namespaceSplit(get_class($exception)); <ide> <ide> if (substr($baseClass, -9) === 'Exception') { <ide> protected function _method(Exception $exception) <ide> /** <ide> * Get error message. <ide> * <del> * @param \Exception $exception Exception. <add> * @param \Throwable $exception Exception. <ide> * @param int $code Error code. <ide> * @return string Error message <ide> */ <del> protected function _message(Exception $exception, $code) <add> protected function _message(Throwable $exception, int $code): string <ide> { <del> $exception = $this->_unwrap($exception); <ide> $message = $exception->getMessage(); <ide> <ide> if (!Configure::read('debug') && <ide> protected function _message(Exception $exception, $code) <ide> /** <ide> * Get template for rendering exception info. <ide> * <del> * @param \Exception $exception Exception instance. <add> * @param \Throwable $exception Exception instance. <ide> * @param string $method Method name. <ide> * @param int $code Error code. <ide> * @return string Template name <ide> */ <del> protected function _template(Exception $exception, $method, $code) <add> protected function _template(Throwable $exception, string $method, int $code): string <ide> { <del> $exception = $this->_unwrap($exception); <ide> $isHttpException = $exception instanceof HttpException; <ide> <ide> if (!Configure::read('debug') && !$isHttpException || $isHttpException) { <ide> protected function _template(Exception $exception, $method, $code) <ide> /** <ide> * Get an error code value within range 400 to 506 <ide> * <del> * @param \Exception $exception Exception. <add> * @param \Throwable $exception Exception. <ide> * @return int Error code value within range 400 to 506 <ide> */ <del> protected function _code(Exception $exception) <add> protected function _code(Throwable $exception): int <ide> { <ide> $code = 500; <del> $exception = $this->_unwrap($exception); <ide> $errorCode = $exception->getCode(); <ide> if ($errorCode >= 400 && $errorCode < 506) { <ide> $code = $errorCode; <ide> protected function _code(Exception $exception) <ide> * @param string $template The template to render. <ide> * @return \Cake\Http\Response A response object that can be sent. <ide> */ <del> protected function _outputMessage($template) <add> protected function _outputMessage(string $template) <ide> { <ide> try { <ide> $this->controller->render($template); <ide> protected function _outputMessage($template) <ide> * @param string $template The template to render. <ide> * @return \Cake\Http\Response A response object that can be sent. <ide> */ <del> protected function _outputMessageSafe($template) <add> protected function _outputMessageSafe(string $template) <ide> { <ide> $helpers = ['Form', 'Html']; <ide> $builder = $this->controller->viewBuilder(); <ide><path>src/Error/ExceptionRendererInterface.php <ide> */ <ide> namespace Cake\Error; <ide> <add>use Psr\Http\Message\ResponseInterface; <add> <ide> /** <ide> * Interface ExceptionRendererInterface <ide> */ <ide> interface ExceptionRendererInterface <ide> * <ide> * @return \Cake\Http\Response The response to be sent. <ide> */ <del> public function render(); <add> public function render(): ResponseInterface; <ide> } <ide><path>src/Error/Middleware/ErrorHandlerMiddleware.php <ide> use Cake\Core\Exception\Exception as CakeException; <ide> use Cake\Core\InstanceConfigTrait; <ide> use Cake\Error\ExceptionRenderer; <del>use Cake\Error\PHP7ErrorException; <ide> use Cake\Log\Log; <ide> use Error; <ide> use Exception; <ide> protected function getRenderer($exception, $request) <ide> $this->exceptionRenderer = $this->getConfig('exceptionRenderer') ?: ExceptionRenderer::class; <ide> } <ide> <del> // For PHP5 backwards compatibility <del> if ($exception instanceof Error) { <del> $exception = new PHP7ErrorException($exception); <del> } <del> <ide> if (is_string($this->exceptionRenderer)) { <ide> $class = App::className($this->exceptionRenderer, 'Error'); <ide> if (!$class) { <ide><path>src/Error/PHP7ErrorException.php <del><?php <del>declare(strict_types=1); <del>/** <del> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <del> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * <del> * Licensed under The MIT License <del> * Redistributions of files must retain the above copyright notice. <del> * <del> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @since 3.1.5 <del> * @license https://opensource.org/licenses/mit-license.php MIT License <del> */ <del>namespace Cake\Error; <del> <del>use Exception; <del> <del>/** <del> * Wraps a PHP 7 Error object inside a normal Exception <del> * so it can be handled correctly by the rest of the <del> * error handling system <del> */ <del>class PHP7ErrorException extends Exception <del>{ <del> <del> /** <del> * The wrapped error object <del> * <del> * @var \Error <del> */ <del> protected $_error; <del> <del> /** <del> * Wraps the passed Error class <del> * <del> * @param \Error $error the Error object <del> */ <del> public function __construct($error) <del> { <del> $this->_error = $error; <del> $this->message = $error->getMessage(); <del> $this->code = $error->getCode(); <del> $this->file = $error->getFile(); <del> $this->line = $error->getLine(); <del> $msg = sprintf( <del> '(%s) - %s in %s on %s', <del> get_class($error), <del> $this->message, <del> $this->file ?: 'null', <del> $this->line ?: 'null' <del> ); <del> parent::__construct($msg, $this->code, $error->getPrevious()); <del> } <del> <del> /** <del> * Returns the wrapped error object <del> * <del> * @return \Error <del> */ <del> public function getError() <del> { <del> return $this->_error; <del> } <del>} <ide><path>tests/TestCase/Error/DebuggerTest.php <ide> public function testExcerpt() <ide> $result = Debugger::excerpt(__FILE__, 11, 2); <ide> $this->assertCount(5, $result); <ide> <del> $pattern = '/<span style\="color\: \#\d{6}">\*<\/span>/'; <add> $pattern = '/<span style\="color\: \#\d{6}">.*?<\/span>/'; <ide> $this->assertRegExp($pattern, $result[0]); <ide> <ide> $return = Debugger::excerpt('[internal]', 2, 2); <ide><path>tests/TestCase/Error/ErrorHandlerTest.php <ide> use Cake\Core\Configure; <ide> use Cake\Core\Plugin; <ide> use Cake\Error\ErrorHandler; <del>use Cake\Error\PHP7ErrorException; <ide> use Cake\Http\Exception\ForbiddenException; <ide> use Cake\Http\Exception\NotFoundException; <ide> use Cake\Http\ServerRequest; <ide> class TestErrorHandler extends ErrorHandler <ide> * <ide> * @return void <ide> */ <del> protected function _clearOutput() <add> protected function _clearOutput(): void <ide> { <ide> // noop <ide> } <ide> protected function _clearOutput() <ide> * <ide> * @return void <ide> */ <del> protected function _sendResponse($response) <add> protected function _sendResponse($response): void <ide> { <ide> $this->response = $response; <ide> } <ide> public function testHandleFatalErrorLog() <ide> $errorHandler->handleFatalError(E_ERROR, 'Something wrong', __FILE__, __LINE__); <ide> } <ide> <del> /** <del> * Tests Handling a PHP7 error <del> * <del> * @return void <del> */ <del> public function testHandlePHP7Error() <del> { <del> $this->skipIf(!class_exists('Error'), 'Requires PHP7'); <del> $error = new PHP7ErrorException(new ParseError('Unexpected variable foo')); <del> $errorHandler = new TestErrorHandler(); <del> <del> $errorHandler->handleException($error); <del> $this->assertContains('Unexpected variable foo', (string)$errorHandler->response->getBody(), 'message missing.'); <del> } <del> <ide> /** <ide> * Data provider for memory limit changing. <ide> * <ide><path>tests/test_app/Plugin/TestPlugin/src/Error/TestPluginExceptionRenderer.php <ide> namespace TestPlugin\Error; <ide> <ide> use Cake\Error\ExceptionRenderer; <add>use Psr\Http\Message\ResponseInterface; <ide> <ide> /** <ide> * TestPluginExceptionRenderer <ide> class TestPluginExceptionRenderer extends ExceptionRenderer <ide> * <ide> * @return string <ide> */ <del> public function render() <add> public function render(): ResponseInterface <ide> { <del> return 'Rendered by test plugin'; <add> $response = $this->controller->getResponse(); <add> <add> return $response->withStringBody('Rendered by test plugin'); <ide> } <ide> }
10
Python
Python
modify flag name for the checkpoint path
2949cfd885794b563f1408a838b6385bd6faadbc
<ide><path>research/learning_unsupervised_learning/run_eval.py <ide> <ide> from tensorflow.contrib.framework.python.framework import checkpoint_utils <ide> <del>flags.DEFINE_string("checkpoint", None, "Dir to load pretrained update rule from") <add>flags.DEFINE_string("checkpoint_dir", None, "Dir to load pretrained update rule from") <ide> flags.DEFINE_string("train_log_dir", None, "Training log directory") <ide> <ide> FLAGS = flags.FLAGS <ide> <ide> <del>def train(train_log_dir, checkpoint, eval_every_n_steps=10, num_steps=3000): <add>def train(train_log_dir, checkpoint_dir, eval_every_n_steps=10, num_steps=3000): <ide> dataset_fn = datasets.mnist.TinyMnist <ide> w_learner_fn = architectures.more_local_weight_update.MoreLocalWeightUpdateWLearner <ide> theta_process_fn = architectures.more_local_weight_update.MoreLocalWeightUpdateProcess <ide> def train(train_log_dir, checkpoint, eval_every_n_steps=10, num_steps=3000): <ide> summary_op = tf.summary.merge_all() <ide> <ide> file_writer = summary_utils.LoggingFileWriter(train_log_dir, regexes=[".*"]) <del> if checkpoint: <del> str_var_list = checkpoint_utils.list_variables(checkpoint) <add> if checkpoint_dir: <add> str_var_list = checkpoint_utils.list_variables(checkpoint_dir) <ide> name_to_v_map = {v.op.name: v for v in tf.all_variables()} <ide> var_list = [ <ide> name_to_v_map[vn] for vn, _ in str_var_list if vn in name_to_v_map <ide> def train(train_log_dir, checkpoint, eval_every_n_steps=10, num_steps=3000): <ide> # global step should be restored from the evals job checkpoint or zero for fresh. <ide> step = sess.run(global_step) <ide> <del> if step == 0 and checkpoint: <add> if step == 0 and checkpoint_dir: <ide> tf.logging.info("force restore") <del> saver.restore(sess, checkpoint) <add> saver.restore(sess, checkpoint_dir) <ide> tf.logging.info("force restore done") <ide> sess.run(reset_global_step) <ide> step = sess.run(global_step) <ide> def train(train_log_dir, checkpoint, eval_every_n_steps=10, num_steps=3000): <ide> <ide> <ide> def main(argv): <del> train(FLAGS.train_log_dir, FLAGS.checkpoint) <add> train(FLAGS.train_log_dir, FLAGS.checkpoint_dir) <ide> <ide> <ide> if __name__ == "__main__":
1
Text
Text
fix missing word in dgram.md
d4aac8399247ceb57cc517cb51ccdb24696ab4b5
<ide><path>doc/api/dgram.md <ide> The maximum size of an `IPv4/v6` datagram depends on the `MTU` <ide> (_Maximum Transmission Unit_) and on the `Payload Length` field size. <ide> <ide> * The `Payload Length` field is `16 bits` wide, which means that a normal <del> payload exceed 64K octets _including_ the internet header and data <add> payload cannot exceed 64K octets _including_ the internet header and data <ide> (65,507 bytes = 65,535 − 8 bytes UDP header − 20 bytes IP header); <ide> this is generally true for loopback interfaces, but such long datagram <ide> messages are impractical for most hosts and networks.
1
Ruby
Ruby
use https during `brew update`
536446b664eadb8574d4a0e057c1129c1257d9fe
<ide><path>Library/Homebrew/cmd/update.rb <ide> def update <ide> end <ide> <ide> class RefreshBrew <del> REPOSITORY_URL = "http://github.com/mxcl/homebrew.git" <add> REPOSITORY_URL = "https://github.com/mxcl/homebrew.git" <ide> FORMULA_DIR = 'Library/Formula/' <ide> EXAMPLE_DIR = 'Library/Contributions/examples/' <ide>
1
Javascript
Javascript
support multi-element group over text nodes
b28f96949ac477b1fe43c81df7cedc21c7ab184c
<ide><path>src/ng/compile.js <ide> function $CompileProvider($provide) { <ide> if (!node) { <ide> throw ngError(51, "Unterminated attribute, found '{0}' but no matching '{1}' found.", attrStart, attrEnd); <ide> } <del> if (node.hasAttribute(attrStart)) depth++; <del> if (node.hasAttribute(attrEnd)) depth--; <add> if (node.nodeType == 1 /** Element **/) { <add> if (node.hasAttribute(attrStart)) depth++; <add> if (node.hasAttribute(attrEnd)) depth--; <add> } <ide> nodes.push(node); <ide> node = node.nextSibling; <ide> } while (depth > 0); <ide><path>test/ng/compileSpec.js <ide> describe('$compile', function() { <ide> })); <ide> <ide> <add> it('should support grouping over text nodes', inject(function($compile, $rootScope) { <add> $rootScope.show = false; <add> element = $compile( <add> '<div>' + <add> '<span ng-repeat-start="i in [1,2]">{{i}}A</span>' + <add> ':' + // Important: proves that we can iterate over non-elements <add> '<span ng-repeat-end>{{i}}B;</span>' + <add> '</div>')($rootScope); <add> $rootScope.$digest(); <add> expect(element.text()).toEqual('1A:1B;2A:2B;'); <add> })); <add> <add> <ide> it('should group on $root compile function', inject(function($compile, $rootScope) { <ide> $rootScope.show = false; <ide> element = $compile(
2
Ruby
Ruby
add initial doc for enqueuing module [ci skip]
56bcd69ade0c6f19e894902d466626999332771b
<ide><path>activejob/lib/active_job/enqueuing.rb <ide> require 'active_job/arguments' <ide> <ide> module ActiveJob <add> # Provides behavior for enqueuing and retrying jobs. <ide> module Enqueuing <ide> extend ActiveSupport::Concern <ide>
1
Ruby
Ruby
fix comments about to_partial_path
e78c5eeba10001223a81203c7b544c09b8394831
<ide><path>activemodel/lib/active_model/conversion.rb <ide> module ActiveModel <ide> # cm.to_model == self # => true <ide> # cm.to_key # => nil <ide> # cm.to_param # => nil <del> # cm.to_path # => "contact_messages/contact_message" <add> # cm.to_partial_path # => "contact_messages/contact_message" <ide> # <ide> module Conversion <ide> extend ActiveSupport::Concern <ide> def to_partial_path <ide> end <ide> <ide> module ClassMethods #:nodoc: <del> # Provide a class level cache for the to_path. This is an <add> # Provide a class level cache for #to_partial_path. This is an <ide> # internal method and should not be accessed directly. <ide> def _to_partial_path #:nodoc: <ide> @_to_partial_path ||= begin <ide><path>activemodel/test/cases/conversion_test.rb <ide> class ConversionTest < ActiveModel::TestCase <ide> assert_equal "1", Contact.new(:id => 1).to_param <ide> end <ide> <del> test "to_path default implementation returns a string giving a relative path" do <add> test "to_partial_path default implementation returns a string giving a relative path" do <ide> assert_equal "contacts/contact", Contact.new.to_partial_path <ide> assert_equal "helicopters/helicopter", Helicopter.new.to_partial_path, <ide> "ActiveModel::Conversion#to_partial_path caching should be class-specific"
2
PHP
PHP
remove @inheritdoc to correctly work with phpstan
3e2a22045850139e81edaa185830272d8f64ccbd
<ide><path>src/ORM/Query.php <ide> public function __construct($connection, $table) <ide> } <ide> <ide> /** <del> * {@inheritDoc} <add> * Adds new fields to be returned by a `SELECT` statement when this query is <add> * executed. Fields can be passed as an array of strings, array of expression <add> * objects, a single expression or a single string. <add> * <add> * If an array is passed, keys will be used to alias fields using the value as the <add> * real field to be aliased. It is possible to alias strings, Expression objects or <add> * even other Query objects. <add> * <add> * If a callable function is passed, the returning array of the function will <add> * be used as the list of fields. <add> * <add> * By default this function will append any passed argument to the list of fields <add> * to be selected, unless the second argument is set to true. <add> * <add> * ### Examples: <add> * <add> * ``` <add> * $query->select(['id', 'title']); // Produces SELECT id, title <add> * $query->select(['author' => 'author_id']); // Appends author: SELECT id, title, author_id as author <add> * $query->select('id', true); // Resets the list: SELECT id <add> * $query->select(['total' => $countQuery]); // SELECT id, (SELECT ...) AS total <add> * $query->select(function ($query) { <add> * return ['article_id', 'total' => $query->count('*')]; <add> * }) <add> * ``` <add> * <add> * By default no fields are selected, if you have an instance of `Cake\ORM\Query` and try to append <add> * fields you should also call `Cake\ORM\Query::enableAutoFields()` to select the default fields <add> * from the table. <ide> * <ide> * If you pass an instance of a `Cake\ORM\Table` or `Cake\ORM\Association` class, <ide> * all the fields in the schema of the table or the association will be added to
1
Go
Go
create portable signalmap
10dc16dcd3aa82be256e5072a25dcf18af8e3844
<ide><path>pkg/signal/signal.go <ide> import ( <ide> "os/signal" <ide> ) <ide> <add>func CatchAll(sigc chan os.Signal) { <add> handledSigs := []os.Signal{} <add> for _, s := range signalMap { <add> handledSigs = append(handledSigs, s) <add> } <add> signal.Notify(sigc, handledSigs...) <add>} <add> <ide> func StopCatch(sigc chan os.Signal) { <ide> signal.Stop(sigc) <ide> close(sigc) <ide><path>pkg/signal/signal_darwin.go <ide> package signal <ide> <ide> import ( <del> "os" <del> "os/signal" <ide> "syscall" <ide> ) <ide> <del>func CatchAll(sigc chan os.Signal) { <del> signal.Notify(sigc, <del> syscall.SIGABRT, <del> syscall.SIGALRM, <del> syscall.SIGBUS, <del> syscall.SIGCHLD, <del> syscall.SIGCONT, <del> syscall.SIGEMT, <del> syscall.SIGFPE, <del> syscall.SIGHUP, <del> syscall.SIGILL, <del> syscall.SIGINFO, <del> syscall.SIGINT, <del> syscall.SIGIO, <del> syscall.SIGIOT, <del> syscall.SIGKILL, <del> syscall.SIGPIPE, <del> syscall.SIGPROF, <del> syscall.SIGQUIT, <del> syscall.SIGSEGV, <del> syscall.SIGSTOP, <del> syscall.SIGSYS, <del> syscall.SIGTERM, <del> syscall.SIGTRAP, <del> syscall.SIGTSTP, <del> syscall.SIGTTIN, <del> syscall.SIGTTOU, <del> syscall.SIGURG, <del> syscall.SIGUSR1, <del> syscall.SIGUSR2, <del> syscall.SIGVTALRM, <del> syscall.SIGWINCH, <del> syscall.SIGXCPU, <del> syscall.SIGXFSZ, <del> ) <add>var signalMap = map[string]syscall.Signal{ <add> "ABRT": syscall.SIGABRT, <add> "ALRM": syscall.SIGALRM, <add> "BUG": syscall.SIGBUS, <add> "CHLD": syscall.SIGCHLD, <add> "CONT": syscall.SIGCONT, <add> "EMT": syscall.SIGEMT, <add> "FPE": syscall.SIGFPE, <add> "HUP": syscall.SIGHUP, <add> "ILL": syscall.SIGILL, <add> "INFO": syscall.SIGINFO, <add> "INT": syscall.SIGINT, <add> "IO": syscall.SIGIO, <add> "IOT": syscall.SIGIOT, <add> "KILL": syscall.SIGKILL, <add> "PIPE": syscall.SIGPIPE, <add> "PROF": syscall.SIGPROF, <add> "QUIT": syscall.SIGQUIT, <add> "SEGV": syscall.SIGSEGV, <add> "STOP": syscall.SIGSTOP, <add> "SYS": syscall.SIGSYS, <add> "TERM": syscall.SIGTERM, <add> "TRAP": syscall.SIGTRAP, <add> "TSTP": syscall.SIGTSTP, <add> "TTIN": syscall.SIGTTIN, <add> "TTOU": syscall.SIGTTOU, <add> "URG": syscall.SIGURG, <add> "USR1": syscall.SIGUSR1, <add> "USR2": syscall.SIGUSR2, <add> "VTALRM": syscall.SIGVTALRM, <add> "WINCH": syscall.SIGWINCH, <add> "XCPU": syscall.SIGXCPU, <add> "XFSZ": syscall.SIGXFSZ, <ide> } <ide><path>pkg/signal/signal_freebsd.go <ide> import ( <ide> "syscall" <ide> ) <ide> <del>func CatchAll(sigc chan os.Signal) { <del> signal.Notify(sigc, <del> syscall.SIGABRT, <del> syscall.SIGALRM, <del> syscall.SIGBUS, <del> syscall.SIGCHLD, <del> syscall.SIGCONT, <del> syscall.SIGFPE, <del> syscall.SIGHUP, <del> syscall.SIGILL, <del> syscall.SIGINT, <del> syscall.SIGIO, <del> syscall.SIGIOT, <del> syscall.SIGKILL, <del> syscall.SIGPIPE, <del> syscall.SIGPROF, <del> syscall.SIGQUIT, <del> syscall.SIGSEGV, <del> syscall.SIGSTOP, <del> syscall.SIGSYS, <del> syscall.SIGTERM, <del> syscall.SIGTRAP, <del> syscall.SIGTSTP, <del> syscall.SIGTTIN, <del> syscall.SIGTTOU, <del> syscall.SIGURG, <del> syscall.SIGUSR1, <del> syscall.SIGUSR2, <del> syscall.SIGVTALRM, <del> syscall.SIGWINCH, <del> syscall.SIGXCPU, <del> syscall.SIGXFSZ, <del> ) <add>var signalMap = map[string]syscall.Signal{ <add> "ABRT": syscall.SIGABRT, <add> "ALRM": syscall.SIGALRM, <add> "BUF": syscall.SIGBUS, <add> "CHLD": syscall.SIGCHLD, <add> "CONT": syscall.SIGCONT, <add> "EMT": syscall.SIGEMT, <add> "FPE": syscall.SIGFPE, <add> "HUP": syscall.SIGHUP, <add> "ILL": syscall.SIGILL, <add> "INFO": syscall.SIGINFO, <add> "INT": syscall.SIGINT, <add> "IO": syscall.SIGIO, <add> "IOT": syscall.SIGIOT, <add> "KILL": syscall.SIGKILL, <add> "LWP": syscall.SIGLWP, <add> "PIPE": syscall.SIGPIPE, <add> "PROF": syscall.SIGPROF, <add> "QUIT": syscall.SIGQUIT, <add> "SEGV": syscall.SIGSEGV, <add> "STOP": syscall.SIGSTOP, <add> "SYS": syscall.SIGSYS, <add> "TERM": syscall.SIGTERM, <add> "THR": syscall.SIGTHR, <add> "TRAP": syscall.SIGTRAP, <add> "TSTP": syscall.SIGTSTP, <add> "TTIN": syscall.SIGTTIN, <add> "TTOU": syscall.SIGTTOU, <add> "URG": syscall.SIGURG, <add> "USR1": syscall.SIGUSR1, <add> "USR2": syscall.SIGUSR2, <add> "VTALRM": syscall.SIGVTALRM, <add> "WINCH": syscall.SIGWINCH, <add> "XCPU": syscall.SIGXCPU, <add> "XFSZ": syscall.SIGXFSZ, <ide> } <ide><path>pkg/signal/signal_linux.go <ide> package signal <ide> <ide> import ( <del> "os" <del> "os/signal" <ide> "syscall" <ide> ) <ide> <del>var signalMap = map[string]syscall.Signal{} <del> <del>/* <del> syscall.SIGABRT, <del> syscall.SIGALRM, <del> syscall.SIGBUS, <del> syscall.SIGCHLD, <del> syscall.SIGCLD, <del> syscall.SIGCONT, <del> syscall.SIGFPE, <del> syscall.SIGHUP, <del> syscall.SIGILL, <del> syscall.SIGINT, <del> syscall.SIGIO, <del> syscall.SIGIOT, <del> syscall.SIGKILL, <del> syscall.SIGPIPE, <del> syscall.SIGPOLL, <del> syscall.SIGPROF, <del> syscall.SIGPWR, <del> syscall.SIGQUIT, <del> syscall.SIGSEGV, <del> syscall.SIGSTKFLT, <del> syscall.SIGSTOP, <del> syscall.SIGSYS, <del> syscall.SIGTERM, <del> syscall.SIGTRAP, <del> syscall.SIGTSTP, <del> syscall.SIGTTIN, <del> syscall.SIGTTOU, <del> syscall.SIGUNUSED, <del> syscall.SIGURG, <del> syscall.SIGUSR1, <del> syscall.SIGUSR2, <del> syscall.SIGVTALRM, <del> syscall.SIGWINCH, <del> syscall.SIGXCPU, <del> syscall.SIGXFSZ, <del>*/ <del> <del>func CatchAll(sigc chan os.Signal) { <del> signal.Notify(sigc, <del> syscall.SIGABRT, <del> syscall.SIGALRM, <del> syscall.SIGBUS, <del> syscall.SIGCHLD, <del> syscall.SIGCLD, <del> syscall.SIGCONT, <del> syscall.SIGFPE, <del> syscall.SIGHUP, <del> syscall.SIGILL, <del> syscall.SIGINT, <del> syscall.SIGIO, <del> syscall.SIGIOT, <del> syscall.SIGKILL, <del> syscall.SIGPIPE, <del> syscall.SIGPOLL, <del> syscall.SIGPROF, <del> syscall.SIGPWR, <del> syscall.SIGQUIT, <del> syscall.SIGSEGV, <del> syscall.SIGSTKFLT, <del> syscall.SIGSTOP, <del> syscall.SIGSYS, <del> syscall.SIGTERM, <del> syscall.SIGTRAP, <del> syscall.SIGTSTP, <del> syscall.SIGTTIN, <del> syscall.SIGTTOU, <del> syscall.SIGUNUSED, <del> syscall.SIGURG, <del> syscall.SIGUSR1, <del> syscall.SIGUSR2, <del> syscall.SIGVTALRM, <del> syscall.SIGWINCH, <del> syscall.SIGXCPU, <del> syscall.SIGXFSZ, <del> ) <add>var signalMap = map[string]syscall.Signal{ <add> "ABRT": syscall.SIGABRT, <add> "ALRM": syscall.SIGALRM, <add> "BUS": syscall.SIGBUS, <add> "CHLD": syscall.SIGCHLD, <add> "CLD": syscall.SIGCLD, <add> "CONT": syscall.SIGCONT, <add> "FPE": syscall.SIGFPE, <add> "HUP": syscall.SIGHUP, <add> "ILL": syscall.SIGILL, <add> "INT": syscall.SIGINT, <add> "IO": syscall.SIGIO, <add> "IOT": syscall.SIGIOT, <add> "KILL": syscall.SIGKILL, <add> "PIPE": syscall.SIGPIPE, <add> "POLL": syscall.SIGPOLL, <add> "PROF": syscall.SIGPROF, <add> "PWR": syscall.SIGPWR, <add> "QUIT": syscall.SIGQUIT, <add> "SEGV": syscall.SIGSEGV, <add> "STKFLT": syscall.SIGSTKFLT, <add> "STOP": syscall.SIGSTOP, <add> "SYS": syscall.SIGSYS, <add> "TERM": syscall.SIGTERM, <add> "TRAP": syscall.SIGTRAP, <add> "TSTP": syscall.SIGTSTP, <add> "TTIN": syscall.SIGTTIN, <add> "TTOU": syscall.SIGTTOU, <add> "UNUSED": syscall.SIGUNUSED, <add> "URG": syscall.SIGURG, <add> "USR1": syscall.SIGUSR1, <add> "USR2": syscall.SIGUSR2, <add> "VTALRM": syscall.SIGVTALRM, <add> "WINCH": syscall.SIGWINCH, <add> "XCPU": syscall.SIGXCPU, <add> "XFSZ": syscall.SIGXFSZ, <ide> } <ide><path>pkg/signal/signal_unsupported.go <add>// +build !linux,!darwin,!freebsd <add> <add>package signal <add> <add>import ( <add> "syscall" <add>) <add> <add>var signalMap = map[string]syscall.Signal{}
5
PHP
PHP
fix cs issues
b1169e82995a6ea628fd77f44e48c833971a104e
<ide><path>tests/Notifications/NotificationSlackChannelTest.php <ide> public function testCorrectPayloadWithAttachmentFieldBuilderIsSentToSlack() <ide> 'title' => 'Special powers', <ide> 'value' => 'Zonda', <ide> 'short' => false, <del> ] <add> ], <ide> ], <ide> ], <ide> ],
1
PHP
PHP
remove blank line
e4eb25e527fa6696dd599f0a0cb07d07ba29b971
<ide><path>src/Illuminate/Database/Query/Builder.php <ide> public function forPageAfterId($perPage = 15, $lastId = 0, $column = 'id') <ide> } <ide> } <ide> } <add> <ide> return $this->where($column, '>', $lastId) <ide> ->orderBy($column, 'asc') <ide> ->take($perPage);
1
Javascript
Javascript
fix new lint errors
739baa90927d06e7e2267c65b1221931a20784a4
<ide><path>src/browser/ui/React.js <ide> * @providesModule React <ide> */ <ide> <add>/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/ <add> <ide> "use strict"; <ide> <ide> var DOMPropertyOperations = require('DOMPropertyOperations'); <ide><path>src/browser/ui/ReactMount.js <ide> var ReactMount = { <ide> 'methods are impure. React cannot handle this case due to ' + <ide> 'cross-browser quirks by rendering at the document root. You ' + <ide> 'should look for environment dependent code in your components ' + <del> 'and ensure the props are the same client and server side:\n' + <add> 'and ensure the props are the same client and server side:\n%s', <ide> difference <ide> ); <ide> <ide><path>src/core/ReactCompositeComponent.js <ide> var ReactCompositeComponentMixin = assign({}, <ide> displayName <ide> ); <ide> } else { <del> for (key in parentKeys) { <del> var key = parentKeys[key]; <add> for (var i = 0; i < parentKeys.length; i++) { <add> var key = parentKeys[i]; <ide> warning( <ide> ownerBasedContext[key] === parentBasedContext[key], <ide> 'owner-based and parent-based contexts differ ' + <ide><path>src/core/__tests__/ReactCompositeComponent-test.js <ide> describe('ReactCompositeComponent', function() { <ide> }); <ide> <ide> var component = React.withContext({foo: 'noise'}, function() { <del> return <Component /> <add> return <Component />; <ide> }); <ide> <ide> ReactTestUtils.renderIntoDocument(<Parent>{component}</Parent>); <ide><path>src/test/ReactTestUtils.js <ide> ReactShallowRenderer.prototype.getRenderOutput = function() { <ide> <ide> var ShallowComponentWrapper = function(inst) { <ide> this._instance = inst; <del>} <add>}; <ide> assign( <ide> ShallowComponentWrapper.prototype, <ide> ReactCompositeComponent.ShallowMixin
5
PHP
PHP
update doc blocks and add an early return
711f29e1c0cfa5d4438fba522f2241228561a633
<ide><path>Cake/Controller/Component/PaginatorComponent.php <ide> public function __construct(ComponentRegistry $collection, $settings = []) { <ide> * Otherwise the top level configuration will be used. <ide> * <ide> * {{{ <del> * $settings = array( <add> * $settings = [ <ide> * 'limit' => 20, <ide> * 'maxLimit' => 100 <del> * ); <add> * ]; <ide> * $results = $paginator->paginate($table, $settings); <ide> * }}} <ide> * <ide> * The above settings will be used to paginate any Table. You can configure Table specific settings by <ide> * keying the settings with the Table alias. <ide> * <ide> * {{{ <del> * $settings = array( <del> * 'Posts' => array( <add> * $settings = [ <add> * 'Articles' => [ <ide> * 'limit' => 20, <ide> * 'maxLimit' => 100 <del> * ), <del> * 'Comments' => array( ... ) <del> * ); <add> * [, <add> * 'Comments' => [ ... ] <add> * ]; <ide> * $results = $paginator->paginate($table, $settings); <ide> * }}} <ide> * <ide> public function __construct(ComponentRegistry $collection, $settings = []) { <ide> * You can paginate with any find type defined on your table using the `findType` option. <ide> * <ide> * {{{ <del> * $settings = array( <del> * 'Post' => array( <del> * 'findType' => 'popular' <del> * ) <del> * ); <del> * $results = $paginator->paginate($table, $settings); <add> * $settings = array( <add> * 'Articles' => array( <add> * 'findType' => 'popular' <add> * ) <add> * ); <add> * $results = $paginator->paginate($table, $settings); <ide> * }}} <ide> * <ide> * Would paginate using the `find('popular')` method. <ide> public function validateSort(Table $object, array $options, array $whitelist = a <ide> $options['order'] = array($options['sort'] => $direction); <ide> } <ide> <del> if (!empty($whitelist) && isset($options['order']) && is_array($options['order'])) { <add> if (empty($options['order']) || (isset($options['order']) && is_array($options['order']))) { <add> $options['order'] = null; <add> return $options; <add> } <add> <add> if (!empty($whitelist)) { <ide> $field = key($options['order']); <ide> $inWhitelist = in_array($field, $whitelist, true); <ide> if (!$inWhitelist) { <ide><path>Cake/Test/TestCase/Controller/Component/PaginatorComponentTest.php <ide> public function testValidateSortNoSort() { <ide> $model->expects($this->any()) <ide> ->method('alias') <ide> ->will($this->returnValue('model')); <del> $model->expects($this->any())->method('hasField')->will($this->returnValue(true)); <add> $model->expects($this->any())->method('hasField') <add> ->will($this->returnValue(true)); <ide> <ide> $options = array('direction' => 'asc'); <ide> $result = $this->Paginator->validateSort($model, $options, array('title', 'id'));
2
Python
Python
improve comments and tests, in response to review
de29dc52ef7d84534471604c901e4de07d8c6073
<ide><path>numpy/ma/core.py <ide> def isMaskedArray(x): <ide> <ide> <ide> class MaskedConstant(MaskedArray): <del> <add> # the lone np.ma.masked instance <ide> __singleton = None <ide> <del> def __new__(self): <del> if self.__singleton is None: <add> def __new__(cls): <add> if cls.__singleton is None: <ide> # We define the masked singleton as a float for higher precedence. <ide> # Note that it can be tricky sometimes w/ type comparison <ide> data = np.array(0.) <ide> def __new__(self): <ide> data.flags.writeable = False <ide> mask.flags.writeable = False <ide> <del> masked = MaskedArray(data, mask=mask) <del> self.__singleton = masked.view(self) <add> # don't fall back on MaskedArray.__new__(MaskedConstant), since <add> # that might confuse it - this way, the construction is entirely <add> # within our control <add> cls.__singleton = MaskedArray(data, mask=mask).view(cls) <ide> <del> return self.__singleton <add> return cls.__singleton <ide> <ide> def __array_finalize__(self, obj): <ide> if self.__singleton is None: <ide> def __array_finalize__(self, obj): <ide> # everywhere else, we want to downcast to MaskedArray, to prevent a <ide> # duplicate maskedconstant. <ide> self.__class__ = MaskedArray <del> self.__array_finalize__(obj) <add> MaskedArray.__array_finalize__(self, obj) <ide> <ide> def __array_prepare__(self, obj, context=None): <ide> return self.view(MaskedArray).__array_prepare__(obj, context) <ide> def __str__(self): <ide> return str(masked_print_option._display) <ide> <ide> def __repr__(self): <del> if self is masked: <add> if self is self.__singleton: <ide> return 'masked' <ide> else: <del> # something is wrong, make it obvious <add> # it's a subclass, or something is wrong, make it obvious <ide> return object.__repr__(self) <ide> <ide> def __reduce__(self): <ide> def __reduce__(self): <ide> <ide> # inplace operations have no effect. We have to override them to avoid <ide> # trying to modify the readonly data and mask arrays <del> def __inop(self, other): <add> def __iop__(self, other): <ide> return self <del> __iadd__ = __isub__ = __imul__ = __ifloordiv__ = __itruediv__ = __ipow__ = __inop <add> __iadd__ = \ <add> __isub__ = \ <add> __imul__ = \ <add> __ifloordiv__ = \ <add> __itruediv__ = \ <add> __ipow__ = \ <add> __iop__ <add> del __iop__ # don't leave this around <ide> <ide> <ide> masked = masked_singleton = MaskedConstant() <ide><path>numpy/ma/tests/test_core.py <ide> def test_write_to_copy(self): <ide> assert_equal(np.ma.masked.mask, True) <ide> <ide> def test_no_copies(self): <add> # when making a view or a copy, downcast to MaskedArray <ide> MC = np.ma.core.MaskedConstant <del> assert_(not isinstance(np.ma.masked[...], MC)) <del> assert_(not isinstance(np.ma.masked.copy(), MC)) <add> <add> m_sl = np.ma.masked[...] <add> assert_equal(type(m_sl), np.ma.MaskedArray) <add> assert_equal(m_sl.mask, True) <add> <add> m_copy = np.ma.masked.copy() <add> assert_equal(type(m_copy), np.ma.MaskedArray) <add> # assert_equal(m_copy.mask, True) - gh-9430 <ide> <ide> def test_immutable(self): <ide> assert_raises(ValueError, operator.setitem, np.ma.masked.data, (), 1)
2
Go
Go
add volumesfrom to mergeconfig, and test
1a226f0e28e7da4eb3701b31dbe959142c42b752
<ide><path>utils.go <ide> func MergeConfig(userConf, imageConf *Config) { <ide> if userConf.Entrypoint == nil || len(userConf.Entrypoint) == 0 { <ide> userConf.Entrypoint = imageConf.Entrypoint <ide> } <add> if userConf.VolumesFrom == "" { <add> userConf.VolumesFrom = imageConf.VolumesFrom <add> } <ide> if userConf.Volumes == nil || len(userConf.Volumes) == 0 { <ide> userConf.Volumes = imageConf.Volumes <ide> } else { <ide><path>utils_test.go <ide> func TestMergeConfig(t *testing.T) { <ide> volumesImage["/test1"] = struct{}{} <ide> volumesImage["/test2"] = struct{}{} <ide> configImage := &Config{ <del> Dns: []string{"1.1.1.1", "2.2.2.2"}, <del> PortSpecs: []string{"1111:1111", "2222:2222"}, <del> Env: []string{"VAR1=1", "VAR2=2"}, <del> Volumes: volumesImage, <add> Dns: []string{"1.1.1.1", "2.2.2.2"}, <add> PortSpecs: []string{"1111:1111", "2222:2222"}, <add> Env: []string{"VAR1=1", "VAR2=2"}, <add> VolumesFrom: "1111", <add> Volumes: volumesImage, <ide> } <ide> <ide> volumesUser := make(map[string]struct{}) <ide> func TestMergeConfig(t *testing.T) { <ide> t.Fatalf("Expected /test1 or /test2 or /test3, found %s", v) <ide> } <ide> } <add> <add> if configUser.VolumesFrom != "1111" { <add> t.Fatalf("Expected VolumesFrom to be 1111, found %s", configUser.VolumesFrom) <add> } <ide> }
2
Mixed
Text
add documentation for stats feature
76141a00779880368b15ef2a5ffd28a80e4637df
<ide><path>api/client/commands.go <ide> func (s *containerStats) Display(w io.Writer) { <ide> } <ide> <ide> func (cli *DockerCli) CmdStats(args ...string) error { <del> cmd := cli.Subcmd("stats", "CONTAINER", "Stream the stats of a container", true) <add> cmd := cli.Subcmd("stats", "CONTAINER", "Display live container stats based on resource usage", true) <ide> cmd.Require(flag.Min, 1) <ide> utils.ParseFlags(cmd, args, true) <ide> <ide><path>docker/flags.go <ide> func init() { <ide> {"save", "Save an image to a tar archive"}, <ide> {"search", "Search for an image on the Docker Hub"}, <ide> {"start", "Start a stopped container"}, <del> {"stats", "Receive container stats"}, <add> {"stats", "Display live container stats based on resource usage"}, <ide> {"stop", "Stop a running container"}, <ide> {"tag", "Tag an image into a repository"}, <ide> {"top", "Lookup the running processes of a container"}, <ide><path>docs/man/docker-stats.1.md <add>% DOCKER(1) Docker User Manuals <add>% Docker Community <add>% JUNE 2014 <add># NAME <add>docker-stats - Display live container stats based on resource usage. <add> <add># SYNOPSIS <add>**docker top** <add>[**--help**] <add>[CONTAINERS] <add> <add># DESCRIPTION <add> <add>Display live container stats based on resource usage. <add> <add># OPTIONS <add>**--help** <add> Print usage statement <add> <add># EXAMPLES <add> <add>Run **docker stats** with multiple containers. <add> <add> $ sudo docker stats redis1 redis2 <add> CONTAINER CPU % MEM USAGE/LIMIT MEM % NET I/O <add> redis1 0.07% 796 KiB/64 MiB 1.21% 788 B/648 B <add> redis2 0.07% 2.746 MiB/64 MiB 4.29% 1.266 KiB/648 B <add> <add># HISTORY <add>April 2014, Originally compiled by William Henry (whenry at redhat dot com) <add>based on docker.com source material and internal work. <add>June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> <ide><path>docs/sources/reference/api/docker_remote_api.md <ide> New endpoint to rename a container `id` to a new name. <ide> (`ReadonlyRootfs`) can be passed in the host config to mount the container's <ide> root filesystem as read only. <ide> <add>`GET /containers/(id)/stats` <add> <add>**New!** <add>This endpoint returns a stream of container stats based on resource usage. <add> <add> <ide> ## v1.16 <ide> <ide> ### Full Documentation <ide><path>docs/sources/reference/api/docker_remote_api_v1.17.md <ide> Status Codes: <ide> - **404** – no such container <ide> - **500** – server error <ide> <add>### Get container stats based on resource usage <add> <add>`GET /containers/(id)/stats` <add> <add>Returns a stream of json objects of the container's stats <add> <add>**Example request**: <add> <add> GET /containers/redis1/stats HTTP/1.1 <add> <add>**Example response**: <add> <add> HTTP/1.1 200 OK <add> Content-Type: application/json <add> <add> { <add> "read" : "2015-01-08T22:57:31.547920715Z", <add> "network" : { <add> "rx_dropped" : 0, <add> "rx_bytes" : 648, <add> "rx_errors" : 0, <add> "tx_packets" : 8, <add> "tx_dropped" : 0, <add> "rx_packets" : 8, <add> "tx_errors" : 0, <add> "tx_bytes" : 648 <add> }, <add> "memory_stats" : { <add> "stats" : { <add> "total_pgmajfault" : 0, <add> "cache" : 0, <add> "mapped_file" : 0, <add> "total_inactive_file" : 0, <add> "pgpgout" : 414, <add> "rss" : 6537216, <add> "total_mapped_file" : 0, <add> "writeback" : 0, <add> "unevictable" : 0, <add> "pgpgin" : 477, <add> "total_unevictable" : 0, <add> "pgmajfault" : 0, <add> "total_rss" : 6537216, <add> "total_rss_huge" : 6291456, <add> "total_writeback" : 0, <add> "total_inactive_anon" : 0, <add> "rss_huge" : 6291456, <add> "hierarchical_memory_limit" : 67108864, <add> "total_pgfault" : 964, <add> "total_active_file" : 0, <add> "active_anon" : 6537216, <add> "total_active_anon" : 6537216, <add> "total_pgpgout" : 414, <add> "total_cache" : 0, <add> "inactive_anon" : 0, <add> "active_file" : 0, <add> "pgfault" : 964, <add> "inactive_file" : 0, <add> "total_pgpgin" : 477 <add> }, <add> "max_usage" : 6651904, <add> "usage" : 6537216, <add> "failcnt" : 0, <add> "limit" : 67108864 <add> }, <add> "blkio_stats" : {}, <add> "cpu_stats" : { <add> "cpu_usage" : { <add> "percpu_usage" : [ <add> 16970827, <add> 1839451, <add> 7107380, <add> 10571290 <add> ], <add> "usage_in_usermode" : 10000000, <add> "total_usage" : 36488948, <add> "usage_in_kernelmode" : 20000000 <add> }, <add> "system_cpu_usage" : 20091722000000000, <add> "throttling_data" : {} <add> } <add> } <add> <add>Status Codes: <add> <add>- **200** – no error <add>- **404** – no such container <add>- **500** – server error <add> <ide> ### Resize a container TTY <ide> <ide> `POST /containers/(id)/resize?h=<height>&w=<width>` <ide><path>docs/sources/reference/commandline/cli.md <ide> more details on finding shared images from the command line. <ide> -a, --attach=false Attach container's STDOUT and STDERR and forward all signals to the process <ide> -i, --interactive=false Attach container's STDIN <ide> <del>When run on a container that has already been started, <del>takes no action and succeeds unconditionally. <add>## stats <add> <add> Usage: docker stats [CONTAINERS] <add> <add> Display live container stats based on resource usage <add> <add> --help=false Print usage <add> <add>Running `docker stats` on two redis containers <add> <add> $ sudo docker stats redis1 redis2 <add> CONTAINER CPU % MEM USAGE/LIMIT MEM % NET I/O <add> redis1 0.07% 796 KiB/64 MiB 1.21% 788 B/648 B <add> redis2 0.07% 2.746 MiB/64 MiB 4.29% 1.266 KiB/648 B <add> <add> <add>When run on running containers live container stats will be streamed <add>back and displayed to the client. Stopped containers will not <add>receive any updates to their stats unless the container is started again. <add> <add>> **Note:** <add>> If you want more in depth resource usage for a container use the API endpoint <ide> <ide> ## stop <ide> <ide><path>integration-cli/docker_api_containers_test.go <ide> import ( <ide> "os/exec" <ide> "strings" <ide> "testing" <add> "time" <ide> <add> "github.com/docker/docker/api/stats" <ide> "github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar" <ide> ) <ide> <ide> func TestVolumesFromHasPriority(t *testing.T) { <ide> <ide> logDone("container REST API - check VolumesFrom has priority") <ide> } <add> <add>func TestGetContainerStats(t *testing.T) { <add> defer deleteAllContainers() <add> name := "statscontainer" <add> <add> runCmd := exec.Command(dockerBinary, "run", "-d", "--name", name, "busybox", "top") <add> out, _, err := runCommandWithOutput(runCmd) <add> if err != nil { <add> t.Fatalf("Error on container creation: %v, output: %q", err, out) <add> } <add> go func() { <add> time.Sleep(4 * time.Second) <add> runCommand(exec.Command(dockerBinary, "kill", name)) <add> runCommand(exec.Command(dockerBinary, "rm", name)) <add> }() <add> <add> body, err := sockRequest("GET", "/containers/"+name+"/stats", nil) <add> if err != nil { <add> t.Fatalf("GET containers/stats sockRequest failed: %v", err) <add> } <add> <add> var s *stats.Stats <add> if err := json.Unmarshal(body, &s); err != nil { <add> t.Fatal(err) <add> } <add> <add> logDone("container REST API - check GET containers/stats") <add>}
7
Javascript
Javascript
fix error object wrapper (#914)
b11d1b228216c592bfff70c662dce6b5d8f66f3d
<ide><path>src/worker.js <ide> var WorkerMessageHandler = { <ide> } catch (e) { <ide> // Turn the error into an obj that can be serialized <ide> e = { <del> message: e.message, <del> stack: e.stack <add> message: typeof e === 'object' ? e.message : e, <add> stack: typeof e === 'object' ? e.stack : null <ide> }; <ide> handler.send('page_error', { <ide> pageNum: pageNum,
1
Ruby
Ruby
remove wrapper div for inputs in button_to
1de258e6c632c8868be71ca088de673562436b96
<ide><path>actionpack/test/controller/request_forgery_protection_test.rb <ide> def test_should_render_button_to_with_token_tag <ide> assert_not_blocked do <ide> get :show_button <ide> end <del> assert_select 'form>div>input[name=?][value=?]', 'custom_authenticity_token', @token <add> assert_select 'form>input[name=?][value=?]', 'custom_authenticity_token', @token <ide> end <ide> <ide> def test_should_render_form_without_token_tag_if_remote <ide><path>actionview/lib/action_view/helpers/url_helper.rb <ide> def button_to(name = nil, options = nil, html_options = nil, &block) <ide> inner_tags.safe_concat tag(:input, type: "hidden", name: param_name, value: value.to_param) <ide> end <ide> end <del> content_tag('form', content_tag('div', inner_tags), form_options) <add> content_tag('form', inner_tags, form_options) <ide> end <ide> <ide> # Creates a link tag of the given +name+ using a URL created by the set of <ide><path>actionview/test/template/url_helper_test.rb <ide> def test_url_for_with_back_and_no_referer <ide> end <ide> <ide> def test_button_to_with_straight_url <del> assert_dom_equal %{<form method="post" action="http://www.example.com" class="button_to"><div><input type="submit" value="Hello" /></div></form>}, button_to("Hello", "http://www.example.com") <add> assert_dom_equal %{<form method="post" action="http://www.example.com" class="button_to"><input type="submit" value="Hello" /></form>}, button_to("Hello", "http://www.example.com") <ide> end <ide> <ide> def test_button_to_with_path <ide> assert_dom_equal( <del> %{<form method="post" action="/article/Hello" class="button_to"><div><input type="submit" value="Hello" /></div></form>}, <add> %{<form method="post" action="/article/Hello" class="button_to"><input type="submit" value="Hello" /></form>}, <ide> button_to("Hello", article_path("Hello".html_safe)) <ide> ) <ide> end <ide> def test_button_to_with_straight_url_and_request_forgery <ide> self.request_forgery = true <ide> <ide> assert_dom_equal( <del> %{<form method="post" action="http://www.example.com" class="button_to"><div><input type="submit" value="Hello" /><input name="form_token" type="hidden" value="secret" /></div></form>}, <add> %{<form method="post" action="http://www.example.com" class="button_to"><input type="submit" value="Hello" /><input name="form_token" type="hidden" value="secret" /></form>}, <ide> button_to("Hello", "http://www.example.com") <ide> ) <ide> ensure <ide> self.request_forgery = false <ide> end <ide> <ide> def test_button_to_with_form_class <del> assert_dom_equal %{<form method="post" action="http://www.example.com" class="custom-class"><div><input type="submit" value="Hello" /></div></form>}, button_to("Hello", "http://www.example.com", form_class: 'custom-class') <add> assert_dom_equal %{<form method="post" action="http://www.example.com" class="custom-class"><input type="submit" value="Hello" /></form>}, button_to("Hello", "http://www.example.com", form_class: 'custom-class') <ide> end <ide> <ide> def test_button_to_with_form_class_escapes <del> assert_dom_equal %{<form method="post" action="http://www.example.com" class="&lt;script&gt;evil_js&lt;/script&gt;"><div><input type="submit" value="Hello" /></div></form>}, button_to("Hello", "http://www.example.com", form_class: '<script>evil_js</script>') <add> assert_dom_equal %{<form method="post" action="http://www.example.com" class="&lt;script&gt;evil_js&lt;/script&gt;"><input type="submit" value="Hello" /></form>}, button_to("Hello", "http://www.example.com", form_class: '<script>evil_js</script>') <ide> end <ide> <ide> def test_button_to_with_query <del> assert_dom_equal %{<form method="post" action="http://www.example.com/q1=v1&amp;q2=v2" class="button_to"><div><input type="submit" value="Hello" /></div></form>}, button_to("Hello", "http://www.example.com/q1=v1&q2=v2") <add> assert_dom_equal %{<form method="post" action="http://www.example.com/q1=v1&amp;q2=v2" class="button_to"><input type="submit" value="Hello" /></form>}, button_to("Hello", "http://www.example.com/q1=v1&q2=v2") <ide> end <ide> <ide> def test_button_to_with_html_safe_URL <del> assert_dom_equal %{<form method="post" action="http://www.example.com/q1=v1&amp;q2=v2" class="button_to"><div><input type="submit" value="Hello" /></div></form>}, button_to("Hello", "http://www.example.com/q1=v1&amp;q2=v2".html_safe) <add> assert_dom_equal %{<form method="post" action="http://www.example.com/q1=v1&amp;q2=v2" class="button_to"><input type="submit" value="Hello" /></form>}, button_to("Hello", "http://www.example.com/q1=v1&amp;q2=v2".html_safe) <ide> end <ide> <ide> def test_button_to_with_query_and_no_name <del> assert_dom_equal %{<form method="post" action="http://www.example.com?q1=v1&amp;q2=v2" class="button_to"><div><input type="submit" value="http://www.example.com?q1=v1&amp;q2=v2" /></div></form>}, button_to(nil, "http://www.example.com?q1=v1&q2=v2") <add> assert_dom_equal %{<form method="post" action="http://www.example.com?q1=v1&amp;q2=v2" class="button_to"><input type="submit" value="http://www.example.com?q1=v1&amp;q2=v2" /></form>}, button_to(nil, "http://www.example.com?q1=v1&q2=v2") <ide> end <ide> <ide> def test_button_to_with_javascript_confirm <ide> assert_dom_equal( <del> %{<form method="post" action="http://www.example.com" class="button_to"><div><input data-confirm="Are you sure?" type="submit" value="Hello" /></div></form>}, <add> %{<form method="post" action="http://www.example.com" class="button_to"><input data-confirm="Are you sure?" type="submit" value="Hello" /></form>}, <ide> button_to("Hello", "http://www.example.com", data: { confirm: "Are you sure?" }) <ide> ) <ide> end <ide> <ide> def test_button_to_with_javascript_disable_with <ide> assert_dom_equal( <del> %{<form method="post" action="http://www.example.com" class="button_to"><div><input data-disable-with="Greeting..." type="submit" value="Hello" /></div></form>}, <add> %{<form method="post" action="http://www.example.com" class="button_to"><input data-disable-with="Greeting..." type="submit" value="Hello" /></form>}, <ide> button_to("Hello", "http://www.example.com", data: { disable_with: "Greeting..." }) <ide> ) <ide> end <ide> <ide> def test_button_to_with_remote_and_form_options <ide> assert_dom_equal( <del> %{<form method="post" action="http://www.example.com" class="custom-class" data-remote="true" data-type="json"><div><input type="submit" value="Hello" /></div></form>}, <add> %{<form method="post" action="http://www.example.com" class="custom-class" data-remote="true" data-type="json"><input type="submit" value="Hello" /></form>}, <ide> button_to("Hello", "http://www.example.com", remote: true, form: { class: "custom-class", "data-type" => "json" }) <ide> ) <ide> end <ide> <ide> def test_button_to_with_remote_and_javascript_confirm <ide> assert_dom_equal( <del> %{<form method="post" action="http://www.example.com" class="button_to" data-remote="true"><div><input data-confirm="Are you sure?" type="submit" value="Hello" /></div></form>}, <add> %{<form method="post" action="http://www.example.com" class="button_to" data-remote="true"><input data-confirm="Are you sure?" type="submit" value="Hello" /></form>}, <ide> button_to("Hello", "http://www.example.com", remote: true, data: { confirm: "Are you sure?" }) <ide> ) <ide> end <ide> <ide> def test_button_to_with_remote_and_javascript_disable_with <ide> assert_dom_equal( <del> %{<form method="post" action="http://www.example.com" class="button_to" data-remote="true"><div><input data-disable-with="Greeting..." type="submit" value="Hello" /></div></form>}, <add> %{<form method="post" action="http://www.example.com" class="button_to" data-remote="true"><input data-disable-with="Greeting..." type="submit" value="Hello" /></form>}, <ide> button_to("Hello", "http://www.example.com", remote: true, data: { disable_with: "Greeting..." }) <ide> ) <ide> end <ide> <ide> def test_button_to_with_remote_false <ide> assert_dom_equal( <del> %{<form method="post" action="http://www.example.com" class="button_to"><div><input type="submit" value="Hello" /></div></form>}, <add> %{<form method="post" action="http://www.example.com" class="button_to"><input type="submit" value="Hello" /></form>}, <ide> button_to("Hello", "http://www.example.com", remote: false) <ide> ) <ide> end <ide> <ide> def test_button_to_enabled_disabled <ide> assert_dom_equal( <del> %{<form method="post" action="http://www.example.com" class="button_to"><div><input type="submit" value="Hello" /></div></form>}, <add> %{<form method="post" action="http://www.example.com" class="button_to"><input type="submit" value="Hello" /></form>}, <ide> button_to("Hello", "http://www.example.com", disabled: false) <ide> ) <ide> assert_dom_equal( <del> %{<form method="post" action="http://www.example.com" class="button_to"><div><input disabled="disabled" type="submit" value="Hello" /></div></form>}, <add> %{<form method="post" action="http://www.example.com" class="button_to"><input disabled="disabled" type="submit" value="Hello" /></form>}, <ide> button_to("Hello", "http://www.example.com", disabled: true) <ide> ) <ide> end <ide> <ide> def test_button_to_with_method_delete <ide> assert_dom_equal( <del> %{<form method="post" action="http://www.example.com" class="button_to"><div><input type="hidden" name="_method" value="delete" /><input type="submit" value="Hello" /></div></form>}, <add> %{<form method="post" action="http://www.example.com" class="button_to"><input type="hidden" name="_method" value="delete" /><input type="submit" value="Hello" /></form>}, <ide> button_to("Hello", "http://www.example.com", method: :delete) <ide> ) <ide> end <ide> <ide> def test_button_to_with_method_get <ide> assert_dom_equal( <del> %{<form method="get" action="http://www.example.com" class="button_to"><div><input type="submit" value="Hello" /></div></form>}, <add> %{<form method="get" action="http://www.example.com" class="button_to"><input type="submit" value="Hello" /></form>}, <ide> button_to("Hello", "http://www.example.com", method: :get) <ide> ) <ide> end <ide> <ide> def test_button_to_with_block <ide> assert_dom_equal( <del> %{<form method="post" action="http://www.example.com" class="button_to"><div><button type="submit"><span>Hello</span></button></div></form>}, <add> %{<form method="post" action="http://www.example.com" class="button_to"><button type="submit"><span>Hello</span></button></form>}, <ide> button_to("http://www.example.com") { content_tag(:span, 'Hello') } <ide> ) <ide> end <ide> <ide> def test_button_to_with_params <ide> assert_dom_equal( <del> %{<form action="http://www.example.com" class="button_to" method="post"><div><input type="submit" value="Hello" /><input type="hidden" name="foo" value="bar" /><input type="hidden" name="baz" value="quux" /></div></form>}, <add> %{<form action="http://www.example.com" class="button_to" method="post"><input type="submit" value="Hello" /><input type="hidden" name="foo" value="bar" /><input type="hidden" name="baz" value="quux" /></form>}, <ide> button_to("Hello", "http://www.example.com", params: {foo: :bar, baz: "quux"}) <ide> ) <ide> end
3
Text
Text
update babel link
e32196222b83a2b21fc44bfd3f6cb9335ccae8db
<ide><path>docs/docs/tutorial.md <ide> For this tutorial, we're going to make it as easy as possible. Included in the s <ide> <title>React Tutorial</title> <ide> <script src="https://unpkg.com/react@{{site.react_version}}/dist/react.js"></script> <ide> <script src="https://unpkg.com/react-dom@{{site.react_version}}/dist/react-dom.js"></script> <del> <script src="https://unpkg.com/babel-core@5.8.38/browser.min.js"></script> <add> <script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script> <ide> <script src="https://unpkg.com/jquery@3.1.0/dist/jquery.min.js"></script> <ide> <script src="https://unpkg.com/remarkable@1.6.2/dist/remarkable.min.js"></script> <ide> </head>
1
Javascript
Javascript
add clearimmediate module
05409868b614e231487b11b33e91182824bd4953
<ide><path>Libraries/vendor/core/clearImmediate.js <add>/** <add> * @generated SignedSource<<4595f3986407fd02332cf9f5fc12e70f>> <add> * <add> * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! <add> * !! This file is a check-in of a static_upstream project! !! <add> * !! !! <add> * !! You should not modify this file directly. Instead: !! <add> * !! 1) Use `fjs use-upstream` to temporarily replace this with !! <add> * !! the latest version from upstream. !! <add> * !! 2) Make your changes, test them, etc. !! <add> * !! 3) Use `fjs push-upstream` to copy your changes back to !! <add> * !! static_upstream. !! <add> * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! <add> * <add> * @providesModule clearImmediate <add> */ <add> <add>module.exports = global.clearImmediate || <add> require('ImmediateImplementation').clearImmediate;
1
Text
Text
fix quotes that failed in the transform
a85903502397f67b701ab039599f7248f90cee61
<ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/add-a-text-alternative-to-images-for-visually-impaired-accessibility.english.md <ide> Camper Cat happens to be both a coding ninja and an actual ninja, and is buildin <ide> ```yml <ide> tests: <ide> - text: 'Your <code>img</code> tag should have an <code>alt</code> attribute, and it should not be empty.' <del> testString: 'assert($(''img'').attr(''alt''), ''Your <code>img</code> tag should have an <code>alt</code> attribute, and it should not be empty.'');' <add> testString: 'assert($("img").attr("alt"), "Your <code>img</code> tag should have an <code>alt</code> attribute, and it should not be empty.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/add-an-accessible-date-picker.english.md <ide> Camper Cat is setting up a Mortal Kombat tournament and wants to ask his competi <ide> ```yml <ide> tests: <ide> - text: Your code should add one <code>input</code> tag for the date selector field. <del> testString: 'assert($(''input'').length == 2, ''Your code should add one <code>input</code> tag for the date selector field.'');' <add> testString: 'assert($("input").length == 2, "Your code should add one <code>input</code> tag for the date selector field.");' <ide> - text: Your <code>input</code> tag should have a <code>type</code> attribute with a value of date. <del> testString: 'assert($(''input'').attr(''type'') == ''date'', ''Your <code>input</code> tag should have a <code>type</code> attribute with a value of date.'');' <add> testString: 'assert($("input").attr("type") == "date", "Your <code>input</code> tag should have a <code>type</code> attribute with a value of date.");' <ide> - text: Your <code>input</code> tag should have an <code>id</code> attribute with a value of pickdate. <del> testString: 'assert($(''input'').attr(''id'') == ''pickdate'', ''Your <code>input</code> tag should have an <code>id</code> attribute with a value of pickdate.'');' <add> testString: 'assert($("input").attr("id") == "pickdate", "Your <code>input</code> tag should have an <code>id</code> attribute with a value of pickdate.");' <ide> - text: Your <code>input</code> tag should have a <code>name</code> attribute with a value of date. <del> testString: 'assert($(''input'').attr(''name'') == ''date'', ''Your <code>input</code> tag should have a <code>name</code> attribute with a value of date.'');' <add> testString: 'assert($("input").attr("name") == "date", "Your <code>input</code> tag should have a <code>name</code> attribute with a value of date.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <form> <ide> <p>Tell us the best date for the competition</p> <ide> <label for="pickdate">Preferred Date:</label> <del> <add> <ide> <!-- Add your code below this line --> <del> <del> <del> <add> <add> <add> <ide> <!-- Add your code above this line --> <del> <add> <ide> <input type="submit" name="submit" value="Submit"> <ide> </form> <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-carefully-choosing-colors-that-convey-information.english.md <ide> Camper Cat is testing different styles for an important button, but the yellow ( <ide> ```yml <ide> tests: <ide> - text: Your code should change the text <code>color</code> for the <code>button</code> to the dark blue. <del> testString: 'assert($(''button'').css(''color'') == ''rgb(0, 51, 102)'', ''Your code should change the text <code>color</code> for the <code>button</code> to the dark blue.'');' <add> testString: 'assert($("button").css("color") == "rgb(0, 51, 102)", "Your code should change the text <code>color</code> for the <code>button</code> to the dark blue.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-using-sufficient-contrast.english.md <ide> Camper Cat is experimenting with using color for his blog text and background, b <ide> ```yml <ide> tests: <ide> - text: Your code should only change the lightness value for the text <code>color</code> property to a value of 15%. <del> testString: 'assert(code.match(/color:\s*?hsl\(0,\s*?55%,\s*?15%\)/gi), ''Your code should only change the lightness value for the text <code>color</code> property to a value of 15%.'');' <add> testString: 'assert(code.match(/color:\s*?hsl\(0,\s*?55%,\s*?15%\)/gi), "Your code should only change the lightness value for the text <code>color</code> property to a value of 15%.");' <ide> - text: Your code should only change the lightness value for the <code>background-color</code> property to a value of 55%. <del> testString: 'assert(code.match(/background-color:\s*?hsl\(120,\s*?25%,\s*?55%\)/gi), ''Your code should only change the lightness value for the <code>background-color</code> property to a value of 55%.'');' <add> testString: 'assert(code.match(/background-color:\s*?hsl\(120,\s*?25%,\s*?55%\)/gi), "Your code should only change the lightness value for the <code>background-color</code> property to a value of 55%.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/give-links-meaning-by-using-descriptive-link-text.english.md <ide> The link text that Camper Cat is using is not very descriptive without the surro <ide> ```yml <ide> tests: <ide> - text: Your code should move the anchor <code>a</code> tags from around the words "Click here" to wrap around the words "information about batteries". <del> testString: 'assert($(''a'').text().match(/^(information about batteries)$/g), ''Your code should move the anchor <code>a</code> tags from around the words "Click here" to wrap around the words "information about batteries".'');' <add> testString: 'assert($("a").text().match(/^(information about batteries)$/g), "Your code should move the anchor <code>a</code> tags from around the words "Click here" to wrap around the words "information about batteries".");' <ide> - text: Make sure your <code>a</code> element has a closing tag. <del> testString: 'assert(code.match(/<\/a>/g) && code.match(/<\/a>/g).length === code.match(/<a href=(''''|"")>/g).length, ''Make sure your <code>a</code> element has a closing tag.'');' <add> testString: 'assert(code.match(/<\/a>/g) && code.match(/<\/a>/g).length === code.match(/<a href=(""|"")>/g).length, "Make sure your <code>a</code> element has a closing tag.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-accessibility-of-audio-content-with-the-audio-element.english.md <ide> Time to take a break from Camper Cat and meet fellow camper Zersiax (@zersiax), <ide> ```yml <ide> tests: <ide> - text: Your code should have one <code>audio</code> tag. <del> testString: 'assert($(''audio'').length === 1, ''Your code should have one <code>audio</code> tag.'');' <add> testString: 'assert($("audio").length === 1, "Your code should have one <code>audio</code> tag.");' <ide> - text: Make sure your <code>audio</code> element has a closing tag. <del> testString: 'assert(code.match(/<\/audio>/g).length === 1 && code.match(/<audio.*>[\s\S]*<\/audio>/g), ''Make sure your <code>audio</code> element has a closing tag.'');' <add> testString: 'assert(code.match(/<\/audio>/g).length === 1 && code.match(/<audio.*>[\s\S]*<\/audio>/g), "Make sure your <code>audio</code> element has a closing tag.");' <ide> - text: The <code>audio</code> tag should have the <code>controls</code> attribute. <del> testString: 'assert($(''audio'').attr(''controls''), ''The <code>audio</code> tag should have the <code>controls</code> attribute.'');' <add> testString: 'assert($("audio").attr("controls"), "The <code>audio</code> tag should have the <code>controls</code> attribute.");' <ide> - text: Your code should have one <code>source</code> tag. <del> testString: 'assert($(''source'').length === 1, ''Your code should have one <code>source</code> tag.'');' <add> testString: 'assert($("source").length === 1, "Your code should have one <code>source</code> tag.");' <ide> - text: Your <code>source</code> tag should be inside the <code>audio</code> tags. <del> testString: 'assert($(''audio'').children(''source'').length === 1, ''Your <code>source</code> tag should be inside the <code>audio</code> tags.'');' <add> testString: 'assert($("audio").children("source").length === 1, "Your <code>source</code> tag should be inside the <code>audio</code> tags.");' <ide> - text: The value for the <code>src</code> attribute on the <code>source</code> tag should match the link in the instructions exactly. <del> testString: 'assert($(''source'').attr(''src'') === ''https://s3.amazonaws.com/freecodecamp/screen-reader.mp3'', ''The value for the <code>src</code> attribute on the <code>source</code> tag should match the link in the instructions exactly.'');' <add> testString: 'assert($("source").attr("src") === "https://s3.amazonaws.com/freecodecamp/screen-reader.mp3", "The value for the <code>src</code> attribute on the <code>source</code> tag should match the link in the instructions exactly.");' <ide> - text: Your code should include a <code>type</code> attribute on the <code>source</code> tag with a value of audio/mpeg. <del> testString: 'assert($(''source'').attr(''type'') === ''audio/mpeg'', ''Your code should include a <code>type</code> attribute on the <code>source</code> tag with a value of audio/mpeg.'');' <add> testString: 'assert($("source").attr("type") === "audio/mpeg", "Your code should include a <code>type</code> attribute on the <code>source</code> tag with a value of audio/mpeg.");' <ide> <ide> ``` <ide> <ide> tests: <ide> </header> <ide> <main> <ide> <p>A sound clip of Zersiax's screen reader in action.</p> <del> <del> <del> <add> <add> <add> <ide> </main> <ide> </body> <ide> ``` <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-chart-accessibility-with-the-figure-element.english.md <ide> Camper Cat is hard at work creating a stacked bar chart showing the amount of ti <ide> ```yml <ide> tests: <ide> - text: Your code should have one <code>figure</code> tag. <del> testString: 'assert($(''figure'').length == 1, ''Your code should have one <code>figure</code> tag.'');' <add> testString: 'assert($("figure").length == 1, "Your code should have one <code>figure</code> tag.");' <ide> - text: Your code should have one <code>figcaption</code> tag. <del> testString: 'assert($(''figcaption'').length == 1, ''Your code should have one <code>figcaption</code> tag.'');' <add> testString: 'assert($("figcaption").length == 1, "Your code should have one <code>figcaption</code> tag.");' <ide> - text: Your code should not have any <code>div</code> tags. <del> testString: 'assert($(''div'').length == 0, ''Your code should not have any <code>div</code> tags.'');' <add> testString: 'assert($("div").length == 0, "Your code should not have any <code>div</code> tags.");' <ide> - text: Your code should not have any <code>p</code> tags. <del> testString: 'assert($(''p'').length == 0, ''Your code should not have any <code>p</code> tags.'');' <add> testString: 'assert($("p").length == 0, "Your code should not have any <code>p</code> tags.");' <ide> - text: The <code>figcaption</code> should be a child of the <code>figure</code> tag. <del> testString: 'assert($(''figure'').children(''figcaption'').length == 1, ''The <code>figcaption</code> should be a child of the <code>figure</code> tag.'');' <add> testString: 'assert($("figure").children("figcaption").length == 1, "The <code>figcaption</code> should be a child of the <code>figure</code> tag.");' <ide> - text: Make sure your <code>figure</code> element has a closing tag. <del> testString: 'assert(code.match(/<\/figure>/g) && code.match(/<\/figure>/g).length === code.match(/<figure>/g).length, ''Make sure your <code>figure</code> element has a closing tag.'');' <add> testString: 'assert(code.match(/<\/figure>/g) && code.match(/<\/figure>/g).length === code.match(/<figure>/g).length, "Make sure your <code>figure</code> element has a closing tag.");' <ide> <ide> ``` <ide> <ide> tests: <ide> </header> <ide> <main> <ide> <section> <del> <add> <ide> <!-- Add your code below this line --> <ide> <div> <ide> <!-- Stacked bar chart will go here --> <ide> <br> <ide> <p>Breakdown per week of time to spend training in stealth, combat, and weapons.</p> <ide> </div> <ide> <!-- Add your code above this line --> <del> <add> <ide> </section> <ide> <section id="stealth"> <ide> <h2>Stealth &amp; Agility Training</h2> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-form-field-accessibility-with-the-label-element.english.md <ide> Camper Cat expects a lot of interest in his thoughtful blog posts, and wants to <ide> ```yml <ide> tests: <ide> - text: Your code should have a <code>for</code> attribute on the <code>label</code> tag that is not empty. <del> testString: 'assert($(''label'').attr(''for''), ''Your code should have a <code>for</code> attribute on the <code>label</code> tag that is not empty.'');' <add> testString: 'assert($("label").attr("for"), "Your code should have a <code>for</code> attribute on the <code>label</code> tag that is not empty.");' <ide> - text: Your <code>for</code> attribute value should match the <code>id</code> value on the email <code>input</code>. <del> testString: 'assert($(''label'').attr(''for'') == ''email'', ''Your <code>for</code> attribute value should match the <code>id</code> value on the email <code>input</code>.'');' <add> testString: 'assert($("label").attr("for") == "email", "Your <code>for</code> attribute value should match the <code>id</code> value on the email <code>input</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <section> <ide> <form> <ide> <p>Sign up to receive Camper Cat's blog posts by email here!</p> <del> <del> <add> <add> <ide> <label>Email:</label> <ide> <input type="text" id="email" name="email"> <del> <del> <add> <add> <ide> <input type="submit" name="submit" value="Submit"> <ide> </form> <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-readability-with-high-contrast-text.english.md <ide> Camper Cat's choice of light gray text on a white background for his recent blog <ide> ```yml <ide> tests: <ide> - text: Your code should change the text <code>color</code> for the <code>body</code> to the darker gray. <del> testString: 'assert($(''body'').css(''color'') == ''rgb(99, 99, 99)'', ''Your code should change the text <code>color</code> for the <code>body</code> to the darker gray.'');' <add> testString: 'assert($("body").css("color") == "rgb(99, 99, 99)", "Your code should change the text <code>color</code> for the <code>body</code> to the darker gray.");' <ide> - text: Your code should not change the <code>background-color</code> for the <code>body</code>. <del> testString: 'assert($(''body'').css(''background-color'') == ''rgb(255, 255, 255)'', ''Your code should not change the <code>background-color</code> for the <code>body</code>.'');' <add> testString: 'assert($("body").css("background-color") == "rgb(255, 255, 255)", "Your code should not change the <code>background-color</code> for the <code>body</code>.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/jump-straight-to-the-content-using-the-main-element.english.md <ide> Camper Cat has some big ideas for his ninja weapons page. Help him set up his ma <ide> ```yml <ide> tests: <ide> - text: Your code should have one <code>main</code> tag. <del> testString: 'assert($(''main'').length == 1, ''Your code should have one <code>main</code> tag.'');' <add> testString: 'assert($("main").length == 1, "Your code should have one <code>main</code> tag.");' <ide> - text: The <code>main</code> tags should be between the closing <code>header</code> tag and the opening <code>footer</code> tag. <del> testString: 'assert(code.match(/<\/header>\s*?<main>\s*?<\/main>/gi), ''The <code>main</code> tags should be between the closing <code>header</code> tag and the opening <code>footer</code> tag.'');' <add> testString: 'assert(code.match(/<\/header>\s*?<main>\s*?<\/main>/gi), "The <code>main</code> tags should be between the closing <code>header</code> tag and the opening <code>footer</code> tag.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/know-when-alt-text-should-be-left-blank.english.md <ide> Camper Cat has coded a skeleton page for the blog part of his website. He's plan <ide> ```yml <ide> tests: <ide> - text: Your <code>img</code> tag should have an <code>alt</code> attribute. <del> testString: 'assert(!($(''img'').attr(''alt'') == undefined), ''Your <code>img</code> tag should have an <code>alt</code> attribute.'');' <add> testString: 'assert(!($("img").attr("alt") == undefined), "Your <code>img</code> tag should have an <code>alt</code> attribute.");' <ide> - text: The <code>alt</code> attribute should be set to an empty string. <del> testString: 'assert($(''img'').attr(''alt'') == '''', ''The <code>alt</code> attribute should be set to an empty string.'');' <add> testString: 'assert($("img").attr("alt") == "", "The <code>alt</code> attribute should be set to an empty string.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-elements-only-visible-to-a-screen-reader-by-using-custom-css.english.md <ide> Camper Cat created a really cool stacked bar chart for his training page, and pu <ide> ```yml <ide> tests: <ide> - text: Your code should set the <code>position</code> property of the <code>sr-only</code> class to a value of absolute. <del> testString: 'assert($(''.sr-only'').css(''position'') == ''absolute'', ''Your code should set the <code>position</code> property of the <code>sr-only</code> class to a value of absolute.'');' <add> testString: 'assert($(".sr-only").css("position") == "absolute", "Your code should set the <code>position</code> property of the <code>sr-only</code> class to a value of absolute.");' <ide> - text: Your code should set the <code>left</code> property of the <code>sr-only</code> class to a value of -10000px. <del> testString: 'assert($(''.sr-only'').css(''left'') == ''-10000px'', ''Your code should set the <code>left</code> property of the <code>sr-only</code> class to a value of -10000px.'');' <add> testString: 'assert($(".sr-only").css("left") == "-10000px", "Your code should set the <code>left</code> property of the <code>sr-only</code> class to a value of -10000px.");' <ide> - text: Your code should set the <code>width</code> property of the <code>sr-only</code> class to a value of 1 pixel. <del> testString: 'assert(code.match(/width:\s*?1px/gi), ''Your code should set the <code>width</code> property of the <code>sr-only</code> class to a value of 1 pixel.'');' <add> testString: 'assert(code.match(/width:\s*?1px/gi), "Your code should set the <code>width</code> property of the <code>sr-only</code> class to a value of 1 pixel.");' <ide> - text: Your code should set the <code>height</code> property of the <code>sr-only</code> class to a value of 1 pixel. <del> testString: 'assert(code.match(/height:\s*?1px/gi), ''Your code should set the <code>height</code> property of the <code>sr-only</code> class to a value of 1 pixel.'');' <add> testString: 'assert(code.match(/height:\s*?1px/gi), "Your code should set the <code>height</code> property of the <code>sr-only</code> class to a value of 1 pixel.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <th scope="col">Stealth &amp; Agility</th> <ide> <th scope="col">Combat</th> <ide> <th scope="col">Weapons</th> <del> <th scope="col">Total</th> <add> <th scope="col">Total</th> <ide> </tr> <ide> </thead> <ide> <tbody> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-links-navigatable-with-html-access-keys.english.md <ide> Camper Cat wants the links around the two blog article titles to have keyboard s <ide> ```yml <ide> tests: <ide> - text: Your code should add an <code>accesskey</code> attribute to the <code>a</code> tag with the <code>id</code> of "first". <del> testString: 'assert($(''#first'').attr(''accesskey''), ''Your code should add an <code>accesskey</code> attribute to the <code>a</code> tag with the <code>id</code> of "first".'');' <add> testString: 'assert($("#first").attr("accesskey"), "Your code should add an <code>accesskey</code> attribute to the <code>a</code> tag with the <code>id</code> of "first".");' <ide> - text: Your code should add an <code>accesskey</code> attribute to the <code>a</code> tag with the <code>id</code> of "second". <del> testString: 'assert($(''#second'').attr(''accesskey''), ''Your code should add an <code>accesskey</code> attribute to the <code>a</code> tag with the <code>id</code> of "second".'');' <add> testString: 'assert($("#second").attr("accesskey"), "Your code should add an <code>accesskey</code> attribute to the <code>a</code> tag with the <code>id</code> of "second".");' <ide> - text: Your code should set the <code>accesskey</code> attribute on the <code>a</code> tag with the <code>id</code> of "first" to "g". Note that case matters. <del> testString: 'assert($(''#first'').attr(''accesskey'') == ''g'', ''Your code should set the <code>accesskey</code> attribute on the <code>a</code> tag with the <code>id</code> of "first" to "g". Note that case matters.'');' <add> testString: 'assert($("#first").attr("accesskey") == "g", "Your code should set the <code>accesskey</code> attribute on the <code>a</code> tag with the <code>id</code> of "first" to "g". Note that case matters.");' <ide> - text: Your code should set the <code>accesskey</code> attribute on the <code>a</code> tag with the <code>id</code> of "second" to "c". Note that case matters. <del> testString: 'assert($(''#second'').attr(''accesskey'') == ''c'', ''Your code should set the <code>accesskey</code> attribute on the <code>a</code> tag with the <code>id</code> of "second" to "c". Note that case matters.'');' <add> testString: 'assert($("#second").attr("accesskey") == "c", "Your code should set the <code>accesskey</code> attribute on the <code>a</code> tag with the <code>id</code> of "second" to "c". Note that case matters.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h1>Deep Thoughts with Master Camper Cat</h1> <ide> </header> <ide> <article> <del> <del> <add> <add> <ide> <h2><a id="first" href="">The Garfield Files: Lasagna as Training Fuel?</a></h2> <del> <del> <add> <add> <ide> <p>The internet is littered with varying opinions on nutritional paradigms, from catnip paleo to hairball cleanses. But let's turn our attention to an often overlooked fitness fuel, and examine the protein-carb-NOM trifecta that is lasagna...</p> <ide> </article> <ide> <article> <del> <del> <add> <add> <ide> <h2><a id="second" href="">Is Chuck Norris a Cat Person?</a></h2> <del> <del> <add> <add> <ide> <p>Chuck Norris is widely regarded as the premier martial artist on the planet, and it's a complete coincidence anyone who disagrees with this fact mysteriously disappears soon after. But the real question is, is he a cat person?...</p> <ide> </article> <ide> <footer>&copy; 2018 Camper Cat</footer> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-footer-landmark.english.md <ide> Camper Cat's training page is making good progress. Change the <code>div</code> <ide> ```yml <ide> tests: <ide> - text: Your code should have one <code>footer</code> tag. <del> testString: 'assert($(''footer'').length == 1, ''Your code should have one <code>footer</code> tag.'');' <add> testString: 'assert($("footer").length == 1, "Your code should have one <code>footer</code> tag.");' <ide> - text: Your code should not have any <code>div</code> tags. <del> testString: 'assert($(''div'').length == 0, ''Your code should not have any <code>div</code> tags.'');' <add> testString: 'assert($("div").length == 0, "Your code should not have any <code>div</code> tags.");' <ide> - text: Your code should have an opening and closing <code>footer</code> tag. <del> testString: 'assert(code.match(/<footer>\s*&copy; 2018 Camper Cat\s*<\/footer>/g), ''Your code should have an opening and closing <code>footer</code> tag.'');' <add> testString: 'assert(code.match(/<footer>\s*&copy; 2018 Camper Cat\s*<\/footer>/g), "Your code should have an opening and closing <code>footer</code> tag.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-header-landmark.english.md <ide> Camper Cat is writing some great articles about ninja training, and wants to add <ide> ```yml <ide> tests: <ide> - text: Your code should have one <code>header</code> tag. <del> testString: 'assert($(''header'').length == 1, ''Your code should have one <code>header</code> tag.'');' <add> testString: 'assert($("header").length == 1, "Your code should have one <code>header</code> tag.");' <ide> - text: Your <code>header</code> tags should wrap around the <code>h1</code>. <del> testString: 'assert($(''header'').children(''h1'').length == 1, ''Your <code>header</code> tags should wrap around the <code>h1</code>.'');' <add> testString: 'assert($("header").children("h1").length == 1, "Your <code>header</code> tags should wrap around the <code>h1</code>.");' <ide> - text: Your code should not have any <code>div</code> tags. <del> testString: 'assert($(''div'').length == 0, ''Your code should not have any <code>div</code> tags.'');' <add> testString: 'assert($("div").length == 0, "Your code should not have any <code>div</code> tags.");' <ide> - text: Make sure your <code>header</code> element has a closing tag. <del> testString: 'assert(code.match(/<\/header>/g) && code.match(/<\/header>/g).length === code.match(/<header>/g).length, ''Make sure your <code>header</code> element has a closing tag.'');' <add> testString: 'assert(code.match(/<\/header>/g) && code.match(/<\/header>/g).length === code.match(/<header>/g).length, "Make sure your <code>header</code> element has a closing tag.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-nav-landmark.english.md <ide> Camper Cat included navigation links at the top of his training page, but wrappe <ide> ```yml <ide> tests: <ide> - text: Your code should have one <code>nav</code> tag. <del> testString: 'assert($(''nav'').length == 1, ''Your code should have one <code>nav</code> tag.'');' <add> testString: 'assert($("nav").length == 1, "Your code should have one <code>nav</code> tag.");' <ide> - text: Your <code>nav</code> tags should wrap around the <code>ul</code> and its list items. <del> testString: 'assert($(''nav'').children(''ul'').length == 1, ''Your <code>nav</code> tags should wrap around the <code>ul</code> and its list items.'');' <add> testString: 'assert($("nav").children("ul").length == 1, "Your <code>nav</code> tags should wrap around the <code>ul</code> and its list items.");' <ide> - text: Your code should not have any <code>div</code> tags. <del> testString: 'assert($(''div'').length == 0, ''Your code should not have any <code>div</code> tags.'');' <add> testString: 'assert($("div").length == 0, "Your code should not have any <code>div</code> tags.");' <ide> - text: Make sure your <code>nav</code> element has a closing tag. <del> testString: 'assert(code.match(/<\/nav>/g) && code.match(/<\/nav>/g).length === code.match(/<nav>/g).length, ''Make sure your <code>nav</code> element has a closing tag.'');' <add> testString: 'assert(code.match(/<\/nav>/g) && code.match(/<\/nav>/g).length === code.match(/<nav>/g).length, "Make sure your <code>nav</code> element has a closing tag.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/standardize-times-with-the-html5-datetime-attribute.english.md <ide> Camper Cat's Mortal Kombat survey results are in! Wrap a <code>time</code> tag a <ide> ```yml <ide> tests: <ide> - text: 'Your <code>time</code> tags should wrap around the text "Thursday, September 15&lt;sup&gt;th&lt;/sup&gt;".' <del> testString: 'assert($(''time'').text().match(/Thursday, September 15th/g), ''Your <code>time</code> tags should wrap around the text "Thursday, September 15&lt;sup&gt;th&lt;/sup&gt;".'');' <add> testString: 'assert($("time").text().match(/Thursday, September 15th/g), "Your <code>time</code> tags should wrap around the text "Thursday, September 15&lt;sup&gt;th&lt;/sup&gt;".");' <ide> - text: Your <code>time</code> tag should have a <code>datetime</code> attribute that is not empty. <del> testString: 'assert($(''time'').attr(''datetime''), ''Your <code>time</code> tag should have a <code>datetime</code> attribute that is not empty.'');' <add> testString: 'assert($("time").attr("datetime"), "Your <code>time</code> tag should have a <code>datetime</code> attribute that is not empty.");' <ide> - text: Your <code>datetime</code> attribute should be set to a value of 2016-09-15. <del> testString: 'assert($(''time'').attr(''datetime'') === "2016-09-15", ''Your <code>datetime</code> attribute should be set to a value of 2016-09-15.'');' <add> testString: 'assert($("time").attr("datetime") === "2016-09-15", "Your <code>datetime</code> attribute should be set to a value of 2016-09-15.");' <ide> - text: Make sure your <code>time</code> element has a closing tag. <del> testString: 'assert(code.match(/<\/time>/g) && code.match(/<\/time>/g).length === 4, ''Make sure your <code>time</code> element has a closing tag.'');' <add> testString: 'assert(code.match(/<\/time>/g) && code.match(/<\/time>/g).length === 4, "Make sure your <code>time</code> element has a closing tag.");' <ide> <ide> ``` <ide> <ide> tests: <ide> </header> <ide> <article> <ide> <h2>Mortal Kombat Tournament Survey Results</h2> <del> <add> <ide> <!-- Add your code below this line --> <del> <add> <ide> <p>Thank you to everyone for responding to Master Camper Cat's survey. The best day to host the vaunted Mortal Kombat tournament is Thursday, September 15<sup>th</sup>. May the best ninja win!</p> <del> <add> <ide> <!-- Add your code above this line --> <del> <add> <ide> <section> <ide> <h3>Comments:</h3> <ide> <article> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/use-headings-to-show-hierarchical-relationships-of-content.english.md <ide> Camper Cat wants a page on his site dedicated to becoming a ninja. Help him fix <ide> ```yml <ide> tests: <ide> - text: Your code should have six <code>h3</code> tags. <del> testString: 'assert($(''h3'').length === 6, ''Your code should have six <code>h3</code> tags.'');' <add> testString: 'assert($("h3").length === 6, "Your code should have six <code>h3</code> tags.");' <ide> - text: Your code should not have any <code>h5</code> tags. <del> testString: 'assert($(''h5'').length === 0, ''Your code should not have any <code>h5</code> tags.'');' <add> testString: 'assert($("h5").length === 0, "Your code should not have any <code>h5</code> tags.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/use-tabindex-to-add-keyboard-focus-to-an-element.english.md <ide> Camper Cat created a new survey to collect information about his users. He knows <ide> ```yml <ide> tests: <ide> - text: Your code should add a <code>tabindex</code> attribute to the <code>p</code> tag that holds the form instructions. <del> testString: 'assert($(''p'').attr(''tabindex''), ''Your code should add a <code>tabindex</code> attribute to the <code>p</code> tag that holds the form instructions.'');' <add> testString: 'assert($("p").attr("tabindex"), "Your code should add a <code>tabindex</code> attribute to the <code>p</code> tag that holds the form instructions.");' <ide> - text: Your code should set the <code>tabindex</code> attribute on the <code>p</code> tag to a value of 0. <del> testString: 'assert($(''p'').attr(''tabindex'') == ''0'', ''Your code should set the <code>tabindex</code> attribute on the <code>p</code> tag to a value of 0.'');' <add> testString: 'assert($("p").attr("tabindex") == "0", "Your code should set the <code>tabindex</code> attribute on the <code>p</code> tag to a value of 0.");' <ide> <ide> ``` <ide> <ide> tests: <ide> </header> <ide> <section> <ide> <form> <del> <del> <add> <add> <ide> <p>Instructions: Fill in ALL your information then click <b>Submit</b></p> <del> <del> <add> <add> <ide> <label for="username">Username:</label> <ide> <input type="text" id="username" name="username"><br> <ide> <fieldset> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/use-tabindex-to-specify-the-order-of-keyboard-focus-for-several-elements.english.md <ide> Camper Cat has a search field on his Inspirational Quotes page that he plans to <ide> ```yml <ide> tests: <ide> - text: Your code should add a <code>tabindex</code> attribute to the search <code>input</code> tag. <del> testString: 'assert($(''#search'').attr(''tabindex''), ''Your code should add a <code>tabindex</code> attribute to the search <code>input</code> tag.'');' <add> testString: 'assert($("#search").attr("tabindex"), "Your code should add a <code>tabindex</code> attribute to the search <code>input</code> tag.");' <ide> - text: Your code should add a <code>tabindex</code> attribute to the submit <code>input</code> tag. <del> testString: 'assert($(''#submit'').attr(''tabindex''), ''Your code should add a <code>tabindex</code> attribute to the submit <code>input</code> tag.'');' <add> testString: 'assert($("#submit").attr("tabindex"), "Your code should add a <code>tabindex</code> attribute to the submit <code>input</code> tag.");' <ide> - text: Your code should set the <code>tabindex</code> attribute on the search <code>input</code> tag to a value of 1. <del> testString: 'assert($(''#search'').attr(''tabindex'') == ''1'', ''Your code should set the <code>tabindex</code> attribute on the search <code>input</code> tag to a value of 1.'');' <add> testString: 'assert($("#search").attr("tabindex") == "1", "Your code should set the <code>tabindex</code> attribute on the search <code>input</code> tag to a value of 1.");' <ide> - text: Your code should set the <code>tabindex</code> attribute on the submit <code>input</code> tag to a value of 2. <del> testString: 'assert($(''#submit'').attr(''tabindex'') == ''2'', ''Your code should set the <code>tabindex</code> attribute on the submit <code>input</code> tag to a value of 2.'');' <add> testString: 'assert($("#submit").attr("tabindex") == "2", "Your code should set the <code>tabindex</code> attribute on the submit <code>input</code> tag to a value of 2.");' <ide> <ide> ``` <ide> <ide> tests: <ide> </header> <ide> <form> <ide> <label for="search">Search:</label> <del> <del> <add> <add> <ide> <input type="search" name="search" id="search"> <ide> <input type="submit" name="submit" value="Submit" id="submit"> <del> <del> <add> <add> <ide> </form> <ide> <h2>Inspirational Quotes</h2> <ide> <blockquote> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/wrap-content-in-the-article-element.english.md <ide> Camper Cat used <code>article</code> tags to wrap the posts on his blog page, bu <ide> ```yml <ide> tests: <ide> - text: Your code should have three <code>article</code> tags. <del> testString: 'assert($(''article'').length == 3, ''Your code should have three <code>article</code> tags.'');' <add> testString: 'assert($("article").length == 3, "Your code should have three <code>article</code> tags.");' <ide> - text: Your code should not have any <code>div</code> tags. <del> testString: 'assert($(''div'').length == 0, ''Your code should not have any <code>div</code> tags.'');' <add> testString: 'assert($("div").length == 0, "Your code should not have any <code>div</code> tags.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-accessibility/wrap-radio-buttons-in-a-fieldset-element-for-better-accessibility.english.md <ide> Camper Cat wants information about the ninja level of his users when they sign u <ide> ```yml <ide> tests: <ide> - text: Your code should have a <code>fieldset</code> tag around the radio button set. <del> testString: 'assert($(''fieldset'').length == 1, ''Your code should have a <code>fieldset</code> tag around the radio button set.'');' <add> testString: 'assert($("fieldset").length == 1, "Your code should have a <code>fieldset</code> tag around the radio button set.");' <ide> - text: Make sure your <code>fieldset</code> element has a closing tag. <del> testString: 'assert(code.match(/<\/fieldset>/g) && code.match(/<\/fieldset>/g).length === code.match(/<fieldset>/g).length, ''Make sure your <code>fieldset</code> element has a closing tag.'');' <add> testString: 'assert(code.match(/<\/fieldset>/g) && code.match(/<\/fieldset>/g).length === code.match(/<fieldset>/g).length, "Make sure your <code>fieldset</code> element has a closing tag.");' <ide> - text: Your code should have a <code>legend</code> tag around the text asking what level ninja a user is. <del> testString: 'assert($(''legend'').length == 1, ''Your code should have a <code>legend</code> tag around the text asking what level ninja a user is.'');' <add> testString: 'assert($("legend").length == 1, "Your code should have a <code>legend</code> tag around the text asking what level ninja a user is.");' <ide> - text: Your code should not have any <code>div</code> tags. <del> testString: 'assert($(''div'').length == 0, ''Your code should not have any <code>div</code> tags.'');' <add> testString: 'assert($("div").length == 0, "Your code should not have any <code>div</code> tags.");' <ide> - text: Your code should no longer have a <code>p</code> tag around the text asking what level ninja a user is. <del> testString: 'assert($(''p'').length == 4, ''Your code should no longer have a <code>p</code> tag around the text asking what level ninja a user is.'');' <add> testString: 'assert($("p").length == 4, "Your code should no longer have a <code>p</code> tag around the text asking what level ninja a user is.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <p>Sign up to receive Camper Cat's blog posts by email here!</p> <ide> <label for="email">Email:</label> <ide> <input type="text" id="email" name="email"> <del> <del> <add> <add> <ide> <!-- Add your code below this line --> <ide> <div> <ide> <p>What level ninja are you?</p> <ide> tests: <ide> <label for="master">Master</label> <ide> </div> <ide> <!-- Add your code above this line --> <del> <del> <add> <add> <ide> <input type="submit" name="submit" value="Submit"> <ide> </form> <ide> </section> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/add-a-box-shadow-to-a-card-like-element.english.md <ide> The element now has an id of <code>thumbnail</code>. With this selector, use the <ide> ```yml <ide> tests: <ide> - text: Your code should add a <code>box-shadow</code> property for the <code>thumbnail</code> id. <del> testString: 'assert(code.match(/#thumbnail\s*?{\s*?box-shadow/g), ''Your code should add a <code>box-shadow</code> property for the <code>thumbnail</code> id.'');' <add> testString: 'assert(code.match(/#thumbnail\s*?{\s*?box-shadow/g), "Your code should add a <code>box-shadow</code> property for the <code>thumbnail</code> id.");' <ide> - text: You should use the given CSS for the <code>box-shadow</code> value. <del> testString: 'assert(code.match(/box-shadow:\s*?0\s+?10px\s+?20px\s+?rgba\(\s*?0\s*?,\s*?0\s*?,\s*?0\s*?,\s*?0?\.19\),\s*?0\s+?6px\s+?6px\s+?rgba\(\s*?0\s*?,\s*?0\s*?,\s*?0\s*?,\s*?0?\.23\)/gi), ''You should use the given CSS for the <code>box-shadow</code> value.'');' <add> testString: 'assert(code.match(/box-shadow:\s*?0\s+?10px\s+?20px\s+?rgba\(\s*?0\s*?,\s*?0\s*?,\s*?0\s*?,\s*?0?\.19\),\s*?0\s+?6px\s+?6px\s+?rgba\(\s*?0\s*?,\s*?0\s*?,\s*?0\s*?,\s*?0?\.23\)/gi), "You should use the given CSS for the <code>box-shadow</code> value.");' <ide> <ide> ``` <ide> <ide> tests: <ide> text-align: left; <ide> color: black; <ide> } <del> <del> <del> <add> <add> <add> <ide> .fullCard { <ide> width: 245px; <ide> border: 1px solid #ccc; <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/adjust-the-background-color-property-of-text.english.md <ide> Also for the <code>h4</code>, remove the <code>height</code> property and add <c <ide> ```yml <ide> tests: <ide> - text: 'Your code should add a <code>background-color</code> property to the <code>h4</code> element set to <code>rgba(45, 45, 45, 0.1)</code>.' <del> testString: 'assert(code.match(/background-color:\s*?rgba\(\s*?45\s*?,\s*?45\s*?,\s*?45\s*?,\s*?0?\.1\s*?\)/gi), ''Your code should add a <code>background-color</code> property to the <code>h4</code> element set to <code>rgba(45, 45, 45, 0.1)</code>.'');' <add> testString: 'assert(code.match(/background-color:\s*?rgba\(\s*?45\s*?,\s*?45\s*?,\s*?45\s*?,\s*?0?\.1\s*?\)/gi), "Your code should add a <code>background-color</code> property to the <code>h4</code> element set to <code>rgba(45, 45, 45, 0.1)</code>.");' <ide> - text: Your code should add a <code>padding</code> property to the <code>h4</code> element and set it to 10 pixels. <del> testString: 'assert($(''h4'').css(''padding-top'') == ''10px'' && $(''h4'').css(''padding-right'') == ''10px'' && $(''h4'').css(''padding-bottom'') == ''10px'' && $(''h4'').css(''padding-left'') == ''10px'', ''Your code should add a <code>padding</code> property to the <code>h4</code> element and set it to 10 pixels.'');' <add> testString: 'assert($("h4").css("padding-top") == "10px" && $("h4").css("padding-right") == "10px" && $("h4").css("padding-bottom") == "10px" && $("h4").css("padding-left") == "10px", "Your code should add a <code>padding</code> property to the <code>h4</code> element and set it to 10 pixels.");' <ide> - text: The <code>height</code> property on the <code>h4</code> element should be removed. <del> testString: 'assert(!($(''h4'').css(''height'') == ''25px''), ''The <code>height</code> property on the <code>h4</code> element should be removed.'');' <add> testString: 'assert(!($("h4").css("height") == "25px"), "The <code>height</code> property on the <code>h4</code> element should be removed.");' <ide> <ide> ``` <ide> <ide> tests: <ide> h4 { <ide> text-align: center; <ide> height: 25px; <del> <del> <add> <add> <ide> } <ide> p { <ide> text-align: justify; <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/adjust-the-color-of-various-elements-to-complementary-colors.english.md <ide> This page will use a shade of teal (<code>#09A7A1</code>) as the dominant color, <ide> ```yml <ide> tests: <ide> - text: 'The <code>header</code> element should have a <code>background-color</code> of #09A7A1.' <del> testString: 'assert($(''header'').css(''background-color'') == ''rgb(9, 167, 161)'', ''The <code>header</code> element should have a <code>background-color</code> of #09A7A1.'');' <add> testString: 'assert($("header").css("background-color") == "rgb(9, 167, 161)", "The <code>header</code> element should have a <code>background-color</code> of #09A7A1.");' <ide> - text: 'The <code>footer</code> element should have a <code>background-color</code> of #09A7A1.' <del> testString: 'assert($(''footer'').css(''background-color'') == ''rgb(9, 167, 161)'', ''The <code>footer</code> element should have a <code>background-color</code> of #09A7A1.'');' <add> testString: 'assert($("footer").css("background-color") == "rgb(9, 167, 161)", "The <code>footer</code> element should have a <code>background-color</code> of #09A7A1.");' <ide> - text: 'The <code>h2</code> element should have a <code>color</code> of #09A7A1.' <del> testString: 'assert($(''h2'').css(''color'') == ''rgb(9, 167, 161)'', ''The <code>h2</code> element should have a <code>color</code> of #09A7A1.'');' <add> testString: 'assert($("h2").css("color") == "rgb(9, 167, 161)", "The <code>h2</code> element should have a <code>color</code> of #09A7A1.");' <ide> - text: 'The <code>button</code> element should have a <code>background-color</code> of #FF790E.' <del> testString: 'assert($(''button'').css(''background-color'') == ''rgb(255, 121, 14)'', ''The <code>button</code> element should have a <code>background-color</code> of #FF790E.'');' <add> testString: 'assert($("button").css("background-color") == "rgb(255, 121, 14)", "The <code>button</code> element should have a <code>background-color</code> of #FF790E.");' <ide> <ide> ``` <ide> <ide> tests: <ide> } <ide> h2 { <ide> color: black; <del> } <add> } <ide> button { <ide> background-color: white; <ide> } <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/adjust-the-height-of-an-element-using-the-height-property.english.md <ide> Add a <code>height</code> property to the <code>h4</code> tag and set it to 25px <ide> ```yml <ide> tests: <ide> - text: Your code should change the <code>h4</code> <code>height</code> property to a value of 25 pixels. <del> testString: 'assert($(''h4'').css(''height'') == ''25px'', ''Your code should change the <code>h4</code> <code>height</code> property to a value of 25 pixels.'');' <add> testString: 'assert($("h4").css("height") == "25px", "Your code should change the <code>h4</code> <code>height</code> property to a value of 25 pixels.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <style> <ide> h4 { <ide> text-align: center; <del> <add> <ide> } <ide> p { <ide> text-align: justify; <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/adjust-the-hover-state-of-an-anchor-tag.english.md <ide> The code editor has a CSS rule to style all <code>a</code> tags black. Add a rul <ide> ```yml <ide> tests: <ide> - text: 'The anchor tag <code>color</code> should remain black, only add CSS rules for the <code>:hover</code> state.' <del> testString: 'assert($(''a'').css(''color'') == ''rgb(0, 0, 0)'', ''The anchor tag <code>color</code> should remain black, only add CSS rules for the <code>:hover</code> state.'');' <add> testString: 'assert($("a").css("color") == "rgb(0, 0, 0)", "The anchor tag <code>color</code> should remain black, only add CSS rules for the <code>:hover</code> state.");' <ide> - text: The anchor tag should have a <code>color</code> of blue on hover. <del> testString: 'assert(code.match(/a:hover\s*?{\s*?color:\s*?blue;\s*?}/gi), ''The anchor tag should have a <code>color</code> of blue on hover.'');' <add> testString: 'assert(code.match(/a:hover\s*?{\s*?color:\s*?blue;\s*?}/gi), "The anchor tag should have a <code>color</code> of blue on hover.");' <ide> <ide> ``` <ide> <ide> tests: <ide> a { <ide> color: #000; <ide> } <del> <del> <del> <add> <add> <add> <ide> </style> <ide> <a href="http://freecatphotoapp.com/" target="_blank">CatPhotoApp</a> <ide> ``` <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/adjust-the-hue-of-a-color.english.md <ide> Change the <code>background-color</code> of each <code>div</code> element based <ide> ```yml <ide> tests: <ide> - text: Your code should use the <code>hsl()</code> property to declare the color green. <del> testString: 'assert(code.match(/\.green\s*?{\s*?background-color:\s*?hsl/gi), ''Your code should use the <code>hsl()</code> property to declare the color green.'');' <add> testString: 'assert(code.match(/\.green\s*?{\s*?background-color:\s*?hsl/gi), "Your code should use the <code>hsl()</code> property to declare the color green.");' <ide> - text: Your code should use the <code>hsl()</code> property to declare the color cyan. <del> testString: 'assert(code.match(/\.cyan\s*?{\s*?background-color:\s*?hsl/gi), ''Your code should use the <code>hsl()</code> property to declare the color cyan.'');' <add> testString: 'assert(code.match(/\.cyan\s*?{\s*?background-color:\s*?hsl/gi), "Your code should use the <code>hsl()</code> property to declare the color cyan.");' <ide> - text: Your code should use the <code>hsl()</code> property to declare the color blue. <del> testString: 'assert(code.match(/\.blue\s*?{\s*?background-color:\s*?hsl/gi), ''Your code should use the <code>hsl()</code> property to declare the color blue.'');' <add> testString: 'assert(code.match(/\.blue\s*?{\s*?background-color:\s*?hsl/gi), "Your code should use the <code>hsl()</code> property to declare the color blue.");' <ide> - text: The <code>div</code> element with class <code>green</code> should have a <code>background-color</code> of green. <del> testString: 'assert($(''.green'').css(''background-color'') == ''rgb(0, 255, 0)'', ''The <code>div</code> element with class <code>green</code> should have a <code>background-color</code> of green.'');' <add> testString: 'assert($(".green").css("background-color") == "rgb(0, 255, 0)", "The <code>div</code> element with class <code>green</code> should have a <code>background-color</code> of green.");' <ide> - text: The <code>div</code> element with class <code>cyan</code> should have a <code>background-color</code> of cyan. <del> testString: 'assert($(''.cyan'').css(''background-color'') == ''rgb(0, 255, 255)'', ''The <code>div</code> element with class <code>cyan</code> should have a <code>background-color</code> of cyan.'');' <add> testString: 'assert($(".cyan").css("background-color") == "rgb(0, 255, 255)", "The <code>div</code> element with class <code>cyan</code> should have a <code>background-color</code> of cyan.");' <ide> - text: The <code>div</code> element with class <code>blue</code> should have a <code>background-color</code> of blue. <del> testString: 'assert($(''.blue'').css(''background-color'') == ''rgb(0, 0, 255)'', ''The <code>div</code> element with class <code>blue</code> should have a <code>background-color</code> of blue.'');' <add> testString: 'assert($(".blue").css("background-color") == "rgb(0, 0, 255)", "The <code>div</code> element with class <code>blue</code> should have a <code>background-color</code> of blue.");' <ide> <ide> ``` <ide> <ide> tests: <ide> body { <ide> background-color: #FFFFFF; <ide> } <del> <add> <ide> .green { <ide> background-color: #000000; <ide> } <del> <add> <ide> .cyan { <ide> background-color: #000000; <ide> } <del> <add> <ide> .blue { <ide> background-color: #000000; <ide> } <del> <add> <ide> div { <ide> display: inline-block; <ide> height: 100px; <ide> width: 100px; <ide> } <ide> </style> <del> <add> <ide> <div class="green"></div> <ide> <div class="cyan"></div> <ide> <div class="blue"></div> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/adjust-the-size-of-a-header-versus-a-paragraph-tag.english.md <ide> To make the heading significantly larger than the paragraph, change the <code>fo <ide> ```yml <ide> tests: <ide> - text: Your code should add a <code>font-size</code> property to the <code>h4</code> element set to 27 pixels. <del> testString: 'assert($(''h4'').css(''font-size'') == ''27px'', ''Your code should add a <code>font-size</code> property to the <code>h4</code> element set to 27 pixels.'');' <add> testString: 'assert($("h4").css("font-size") == "27px", "Your code should add a <code>font-size</code> property to the <code>h4</code> element set to 27 pixels.");' <ide> <ide> ``` <ide> <ide> tests: <ide> text-align: center; <ide> background-color: rgba(45, 45, 45, 0.1); <ide> padding: 10px; <del> <add> <ide> } <ide> p { <ide> text-align: justify; <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/adjust-the-tone-of-a-color.english.md <ide> The navigation bar on this site currently inherits its <code>background-color</c <ide> ```yml <ide> tests: <ide> - text: The <code>nav</code> element should have a <code>background-color</code> of the adjusted cyan tone using the <code>hsl()</code> property. <del> testString: 'assert(code.match(/nav\s*?{\s*?background-color:\s*?hsl\(180,\s*?80%,\s*?25%\)/gi), ''The <code>nav</code> element should have a <code>background-color</code> of the adjusted cyan tone using the <code>hsl()</code> property.'');' <add> testString: 'assert(code.match(/nav\s*?{\s*?background-color:\s*?hsl\(180,\s*?80%,\s*?25%\)/gi), "The <code>nav</code> element should have a <code>background-color</code> of the adjusted cyan tone using the <code>hsl()</code> property.");' <ide> <ide> ``` <ide> <ide> tests: <ide> background-color: hsl(180, 90%, 35%); <ide> color: #FFFFFF; <ide> } <del> <add> <ide> nav { <del> <add> <ide> } <del> <add> <ide> h1 { <ide> text-indent: 10px; <ide> padding-top: 10px; <ide> } <del> <add> <ide> nav ul { <ide> margin: 0px; <ide> padding: 5px 0px 5px 30px; <ide> } <del> <add> <ide> nav li { <ide> display: inline; <ide> margin-right: 20px; <ide> } <del> <add> <ide> a { <ide> text-decoration: none; <ide> color: inherit; <ide> } <ide> </style> <del> <add> <ide> <header> <ide> <h1>Cooking with FCC!</h1> <ide> <nav> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/adjust-the-width-of-an-element-using-the-width-property.english.md <ide> Add a <code>width</code> property to the entire card and set it to an absolute v <ide> ```yml <ide> tests: <ide> - text: Your code should change the <code>width</code> property of the card to 245 pixels by using the <code>fullCard</code> class selector. <del> testString: 'assert(code.match(/.fullCard\s*{[\s\S][^}]*\n*^\s*width\s*:\s*245px\s*;/gm), ''Your code should change the <code>width</code> property of the card to 245 pixels by using the <code>fullCard</code> class selector.'');' <add> testString: 'assert(code.match(/.fullCard\s*{[\s\S][^}]*\n*^\s*width\s*:\s*245px\s*;/gm), "Your code should change the <code>width</code> property of the card to 245 pixels by using the <code>fullCard</code> class selector.");' <ide> <ide> ``` <ide> <ide> tests: <ide> text-align: left; <ide> } <ide> .fullCard { <del> <add> <ide> border: 1px solid #ccc; <ide> border-radius: 5px; <ide> margin: 10px 5px; <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/animate-elements-at-variable-rates.english.md <ide> Alter the animation rate for the element with the class name of <code>star-1</co <ide> ```yml <ide> tests: <ide> - text: The <code>@keyframes</code> rule for the <code>star-1</code> class should be 50%. <del> testString: 'assert(code.match(/twinkle-1\s*?{\s*?50%/g), ''The <code>@keyframes</code> rule for the <code>star-1</code> class should be 50%.'');' <add> testString: 'assert(code.match(/twinkle-1\s*?{\s*?50%/g), "The <code>@keyframes</code> rule for the <code>star-1</code> class should be 50%.");' <ide> <ide> ``` <ide> <ide> tests: <ide> } <ide> <ide> .star-1 { <del> margin-top: 15%; <add> margin-top: 15%; <ide> margin-left: 60%; <ide> animation-name: twinkle-1; <ide> animation-duration: 1s; <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/animate-elements-continually-using-an-infinite-animation-count.english.md <ide> To keep the ball bouncing on the right on a continuous loop, change the <code>an <ide> ```yml <ide> tests: <ide> - text: The <code>animation-iteration-count</code> property should have a value of infinite. <del> testString: 'assert($(''#ball'').css(''animation-iteration-count'') == ''infinite'', ''The <code>animation-iteration-count</code> property should have a value of infinite.'');' <add> testString: 'assert($("#ball").css("animation-iteration-count") == "infinite", "The <code>animation-iteration-count</code> property should have a value of infinite.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/animate-multiple-elements-at-variable-rates.english.md <ide> Set the <code>animation-duration</code> of the elements with the classes <code>s <ide> ```yml <ide> tests: <ide> - text: The <code>animation-duration</code> property for the star with class <code>star-1</code> should remain at 1s. <del> testString: 'assert($(''.star-1'').css(''animation-duration'') == ''1s'', ''The <code>animation-duration</code> property for the star with class <code>star-1</code> should remain at 1s.'');' <add> testString: 'assert($(".star-1").css("animation-duration") == "1s", "The <code>animation-duration</code> property for the star with class <code>star-1</code> should remain at 1s.");' <ide> - text: The <code>animation-duration</code> property for the star with class <code>star-2</code> should be 0.9s. <del> testString: 'assert($(''.star-2'').css(''animation-duration'') == ''0.9s'', ''The <code>animation-duration</code> property for the star with class <code>star-2</code> should be 0.9s.'');' <add> testString: 'assert($(".star-2").css("animation-duration") == "0.9s", "The <code>animation-duration</code> property for the star with class <code>star-2</code> should be 0.9s.");' <ide> - text: The <code>animation-duration</code> property for the star with class <code>star-3</code> should be 1.1s. <del> testString: 'assert($(''.star-3'').css(''animation-duration'') == ''1.1s'', ''The <code>animation-duration</code> property for the star with class <code>star-3</code> should be 1.1s.'');' <add> testString: 'assert($(".star-3").css("animation-duration") == "1.1s", "The <code>animation-duration</code> property for the star with class <code>star-3</code> should be 1.1s.");' <ide> <ide> ``` <ide> <ide> tests: <ide> } <ide> <ide> .star-1 { <del> margin-top: 15%; <add> margin-top: 15%; <ide> margin-left: 60%; <ide> animation-duration: 1s; <ide> animation-name: twinkle; <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/center-an-element-horizontally-using-the-margin-property.english.md <ide> Center the <code>div</code> on the page by adding a <code>margin</code> property <ide> ```yml <ide> tests: <ide> - text: The <code>div</code> should have a <code>margin</code> set to auto. <del> testString: 'assert(code.match(/margin:\s*?auto;/g), ''The <code>div</code> should have a <code>margin</code> set to auto.'');' <add> testString: 'assert(code.match(/margin:\s*?auto;/g), "The <code>div</code> should have a <code>margin</code> set to auto.");' <ide> <ide> ``` <ide> <ide> tests: <ide> background-color: blue; <ide> height: 100px; <ide> width: 100px; <del> <add> <ide> } <ide> </style> <ide> <div></div> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/change-an-elements-relative-position.english.md <ide> Change the <code>position</code> of the <code>h2</code> to <code>relative</code> <ide> ```yml <ide> tests: <ide> - text: The <code>h2</code> element should have a <code>position</code> property set to <code>relative</code>. <del> testString: 'assert($(''h2'').css(''position'') == ''relative'', ''The <code>h2</code> element should have a <code>position</code> property set to <code>relative</code>.'');' <add> testString: 'assert($("h2").css("position") == "relative", "The <code>h2</code> element should have a <code>position</code> property set to <code>relative</code>.");' <ide> - text: Your code should use a CSS offset to relatively position the <code>h2</code> 15px away from the <code>top</code> of where it normally sits. <del> testString: 'assert($(''h2'').css(''top'') == ''15px'', ''Your code should use a CSS offset to relatively position the <code>h2</code> 15px away from the <code>top</code> of where it normally sits.'');' <add> testString: 'assert($("h2").css("top") == "15px", "Your code should use a CSS offset to relatively position the <code>h2</code> 15px away from the <code>top</code> of where it normally sits.");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```html <ide> <style> <ide> h2 { <del> <del> <add> <add> <ide> } <ide> </style> <ide> <body> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/change-animation-timing-with-keywords.english.md <ide> For the elements with id of <code>ball1</code> and <code>ball2</code>, add an <c <ide> ```yml <ide> tests: <ide> - text: The value of the <code>animation-timing-function</code> property for the element with the id <code>ball1</code> should be linear. <del> testString: 'assert($(''#ball1'').css(''animation-timing-function'') == ''linear'', ''The value of the <code>animation-timing-function</code> property for the element with the id <code>ball1</code> should be linear.'');' <add> testString: 'assert($("#ball1").css("animation-timing-function") == "linear", "The value of the <code>animation-timing-function</code> property for the element with the id <code>ball1</code> should be linear.");' <ide> - text: The value of the <code>animation-timing-function</code> property for the element with the id <code>ball2</code> should be ease-out. <del> testString: 'assert($(''#ball2'').css(''animation-timing-function'') == ''ease-out'', ''The value of the <code>animation-timing-function</code> property for the element with the id <code>ball2</code> should be ease-out.'');' <add> testString: 'assert($("#ball2").css("animation-timing-function") == "ease-out", "The value of the <code>animation-timing-function</code> property for the element with the id <code>ball2</code> should be ease-out.");' <ide> <ide> ``` <ide> <ide> tests: <ide> #ccffff, <ide> #ffcccc <ide> ); <del> position: fixed; <add> position: fixed; <ide> width: 50px; <ide> height: 50px; <ide> margin-top: 50px; <ide> animation-name: bounce; <ide> animation-duration: 2s; <ide> animation-iteration-count: infinite; <ide> } <del> #ball1 { <add> #ball1 { <ide> left:27%; <del> <add> <ide> } <del> #ball2 { <add> #ball2 { <ide> left:56%; <del> <add> <ide> } <ide> <ide> @keyframes bounce { <ide> 0% { <ide> top: 0px; <del> } <add> } <ide> 100% { <ide> top: 249px; <ide> } <del>} <add>} <ide> <ide> </style> <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/change-the-position-of-overlapping-elements-with-the-z-index-property.english.md <ide> Add a <code>z-index</code> property to the element with the class name of <code> <ide> ```yml <ide> tests: <ide> - text: The element with class <code>first</code> should have a <code>z-index</code> value of 2. <del> testString: 'assert($(''.first'').css(''z-index'') == ''2'', ''The element with class <code>first</code> should have a <code>z-index</code> value of 2.'');' <add> testString: 'assert($(".first").css("z-index") == "2", "The element with class <code>first</code> should have a <code>z-index</code> value of 2.");' <ide> <ide> ``` <ide> <ide> tests: <ide> height: 200px; <ide> margin-top: 20px; <ide> } <del> <add> <ide> .first { <ide> background-color: red; <ide> position: absolute; <del> <add> <ide> } <ide> .second { <ide> background-color: blue; <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-a-gradual-css-linear-gradient.english.md <ide> Use a <code>linear-gradient()</code> for the <code>div</code> element's <code>ba <ide> ```yml <ide> tests: <ide> - text: The <code>div</code> element should have a <code>linear-gradient</code> <code>background</code> with the specified direction and colors. <del> testString: 'assert(code.match(/background:\s*?linear-gradient\(35deg,\s*?(#CCFFFF|#CFF),\s*?(#FFCCCC|#FCC)\);/gi), ''The <code>div</code> element should have a <code>linear-gradient</code> <code>background</code> with the specified direction and colors.'');' <add> testString: 'assert(code.match(/background:\s*?linear-gradient\(35deg,\s*?(#CCFFFF|#CFF),\s*?(#FFCCCC|#FCC)\);/gi), "The <code>div</code> element should have a <code>linear-gradient</code> <code>background</code> with the specified direction and colors.");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```html <ide> <style> <ide> <del> div{ <add> div{ <ide> border-radius: 20px; <ide> width: 70%; <ide> height: 400px; <ide> margin: 50px auto; <del> <add> <ide> } <ide> <ide> </style> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-a-graphic-using-css.english.md <ide> Manipulate the square element in the editor to create the moon shape. First, cha <ide> ```yml <ide> tests: <ide> - text: The value of the <code>background-color</code> property should be set to <code>transparent</code>. <del> testString: 'assert(code.match(/background-color:\s*?transparent;/gi), ''The value of the <code>background-color</code> property should be set to <code>transparent</code>.'');' <add> testString: 'assert(code.match(/background-color:\s*?transparent;/gi), "The value of the <code>background-color</code> property should be set to <code>transparent</code>.");' <ide> - text: The value of the <code>border-radius</code> property should be set to <code>50%</code>. <del> testString: 'assert(code.match(/border-radius:\s*?50%;/gi), ''The value of the <code>border-radius</code> property should be set to <code>50%</code>.'');' <add> testString: 'assert(code.match(/border-radius:\s*?50%;/gi), "The value of the <code>border-radius</code> property should be set to <code>50%</code>.");' <ide> - text: 'The value of the <code>box-shadow</code> property should be set to 25px for <code>offset-x</code>, 10px for <code>offset-y</code>, 0 for <code>blur-radius</code>, 0 for <code>spread-radius</code>, and finally blue for the color.' <del> testString: 'assert(code.match(/box-shadow:\s*?25px\s+?10px\s+?0(px)?\s+?0(px)?\s+?blue\s*?;/gi), ''The value of the <code>box-shadow</code> property should be set to 25px for <code>offset-x</code>, 10px for <code>offset-y</code>, 0 for <code>blur-radius</code>, 0 for <code>spread-radius</code>, and finally blue for the color.'');' <add> testString: 'assert(code.match(/box-shadow:\s*?25px\s+?10px\s+?0(px)?\s+?0(px)?\s+?blue\s*?;/gi), "The value of the <code>box-shadow</code> property should be set to 25px for <code>offset-x</code>, 10px for <code>offset-y</code>, 0 for <code>blur-radius</code>, 0 for <code>spread-radius</code>, and finally blue for the color.");' <ide> <ide> ``` <ide> <ide> tests: <ide> left: 0; <ide> width: 100px; <ide> height: 100px; <del> <add> <ide> background-color: blue; <ide> border-radius: 0px; <del> box-shadow: 25px 10px 10px 10px green; <add> box-shadow: 25px 10px 10px 10px green; <ide> } <ide> <ide> </style> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-a-horizontal-line-using-the-hr-element.english.md <ide> Add an <code>hr</code> tag underneath the <code>h4</code> which contains the car <ide> ```yml <ide> tests: <ide> - text: Your code should add an <code>hr</code> tag to the markup. <del> testString: 'assert($(''hr'').length == 1, ''Your code should add an <code>hr</code> tag to the markup.'');' <add> testString: 'assert($("hr").length == 1, "Your code should add an <code>hr</code> tag to the markup.");' <ide> - text: The <code>hr</code> tag should come between the title and the paragraph. <del> testString: 'assert(code.match(/<\/h4>\s*?<hr(>|\s*?\/>)\s*?<p>/gi), ''The <code>hr</code> tag should come between the title and the paragraph.'');' <add> testString: 'assert(code.match(/<\/h4>\s*?<hr(>|\s*?\/>)\s*?<p>/gi), "The <code>hr</code> tag should come between the title and the paragraph.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <div class="cardContent"> <ide> <div class="cardText"> <ide> <h4><s>Google</s>Alphabet</h4> <del> <add> <ide> <p><em>Google was founded by Larry Page and Sergey Brin while they were <u>Ph.D. students</u> at <strong>Stanford University</strong>.</em></p> <ide> </div> <ide> <div class="cardLinks"> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-a-more-complex-shape-using-css-and-html.english.md <ide> Finally, in the <code>heart::before</code> selector, set its <code>content</code <ide> ```yml <ide> tests: <ide> - text: 'The <code>background-color</code> property of the <code>heart::after</code> selector should be pink.' <del> testString: 'assert(code.match(/\.heart::after\s*?{\s*?background-color\s*?:\s*?pink\s*?;/gi), ''The <code>background-color</code> property of the <code>heart::after</code> selector should be pink.'');' <add> testString: 'assert(code.match(/\.heart::after\s*?{\s*?background-color\s*?:\s*?pink\s*?;/gi), "The <code>background-color</code> property of the <code>heart::after</code> selector should be pink.");' <ide> - text: 'The <code>border-radius</code> of the <code>heart::after</code> selector should be 50%.' <del> testString: 'assert(code.match(/border-radius\s*?:\s*?50%/gi).length == 2, ''The <code>border-radius</code> of the <code>heart::after</code> selector should be 50%.'');' <add> testString: 'assert(code.match(/border-radius\s*?:\s*?50%/gi).length == 2, "The <code>border-radius</code> of the <code>heart::after</code> selector should be 50%.");' <ide> - text: The <code>transform</code> property for the <code>heart</code> class should use a <code>rotate()</code> function set to -45 degrees. <del> testString: 'assert(code.match(/transform\s*?:\s*?rotate\(\s*?-45deg\s*?\)/gi), ''The <code>transform</code> property for the <code>heart</code> class should use a <code>rotate()</code> function set to -45 degrees.'');' <add> testString: 'assert(code.match(/transform\s*?:\s*?rotate\(\s*?-45deg\s*?\)/gi), "The <code>transform</code> property for the <code>heart</code> class should use a <code>rotate()</code> function set to -45 degrees.");' <ide> - text: 'The <code>content</code> of the <code>heart::before</code> selector should be an empty string.' <del> testString: 'assert(code.match(/\.heart::before\s*?{\s*?content\s*?:\s*?("|'')\1\s*?;/gi), ''The <code>content</code> of the <code>heart::before</code> selector should be an empty string.'');' <add> testString: 'assert(code.match(/\.heart::before\s*?{\s*?content\s*?:\s*?("|")\1\s*?;/gi), "The <code>content</code> of the <code>heart::before</code> selector should be an empty string.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-movement-using-css-animation.english.md <ide> Add a horizontal motion to the <code>div</code> animation. Using the <code>left< <ide> ```yml <ide> tests: <ide> - text: The <code>@keyframes</code> rule for <code>0%</code> should use the <code>left</code> offset of 0px. <del> testString: 'assert(code.match(/0%\s*?{\s*?background-color:\s*?blue;\s*?top:\s*?0(px)?;\s*?left:\s*?0(px)?;\s*?}/gi), ''The <code>@keyframes</code> rule for <code>0%</code> should use the <code>left</code> offset of 0px.'');' <add> testString: 'assert(code.match(/0%\s*?{\s*?background-color:\s*?blue;\s*?top:\s*?0(px)?;\s*?left:\s*?0(px)?;\s*?}/gi), "The <code>@keyframes</code> rule for <code>0%</code> should use the <code>left</code> offset of 0px.");' <ide> - text: The <code>@keyframes</code> rule for <code>50%</code> should use the <code>left</code> offset of 25px. <del> testString: 'assert(code.match(/50%\s*?{\s*?background-color:\s*?green;\s*?top:\s*?50px;\s*?left:\s*?25px;\s*?}/gi), ''The <code>@keyframes</code> rule for <code>50%</code> should use the <code>left</code> offset of 25px.'');' <add> testString: 'assert(code.match(/50%\s*?{\s*?background-color:\s*?green;\s*?top:\s*?50px;\s*?left:\s*?25px;\s*?}/gi), "The <code>@keyframes</code> rule for <code>50%</code> should use the <code>left</code> offset of 25px.");' <ide> - text: The <code>@keyframes</code> rule for <code>100%</code> should use the <code>left</code> offset of -25px. <del> testString: 'assert(code.match(/100%\s*?{\s*?background-color:\s*?yellow;\s*?top:\s*?0(px)?;\s*?left:\s*?-25px;\s*?}/gi), ''The <code>@keyframes</code> rule for <code>100%</code> should use the <code>left</code> offset of -25px.'');' <add> testString: 'assert(code.match(/100%\s*?{\s*?background-color:\s*?yellow;\s*?top:\s*?0(px)?;\s*?left:\s*?-25px;\s*?}/gi), "The <code>@keyframes</code> rule for <code>100%</code> should use the <code>left</code> offset of -25px.");' <ide> <ide> ``` <ide> <ide> tests: <ide> 0% { <ide> background-color: blue; <ide> top: 0px; <del> <add> <ide> } <ide> 50% { <ide> background-color: green; <ide> top: 50px; <del> <add> <ide> } <ide> 100% { <ide> background-color: yellow; <ide> top: 0px; <del> <add> <ide> } <ide> } <ide> </style> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-texture-by-adding-a-subtle-pattern-as-a-background-image.english.md <ide> Using the url of <code>https://i.imgur.com/MJAkxbh.png</code>, set the <code>bac <ide> ```yml <ide> tests: <ide> - text: Your <code>body</code> element should have a <code>background</code> property set to a <code>url()</code> with the given link. <del> testString: 'assert(code.match(/background:\s*?url\(\s*("|''|)https:\/\/i\.imgur\.com\/MJAkxbh\.png\1\s*\)/gi), ''Your <code>body</code> element should have a <code>background</code> property set to a <code>url()</code> with the given link.'');' <add> testString: 'assert(code.match(/background:\s*?url\(\s*("|"|)https:\/\/i\.imgur\.com\/MJAkxbh\.png\1\s*\)/gi), "Your <code>body</code> element should have a <code>background</code> property set to a <code>url()</code> with the given link.");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```html <ide> <style> <ide> body { <del> <add> <ide> } <ide> </style> <ide> ``` <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-visual-balance-using-the-text-align-property.english.md <ide> Align the <code>h4</code> tag's text, which says "Google", to the center. Then j <ide> ```yml <ide> tests: <ide> - text: Your code should use the text-align property on the <code>h4</code> tag to set it to center. <del> testString: 'assert($(''h4'').css(''text-align'') == ''center'', ''Your code should use the text-align property on the <code>h4</code> tag to set it to center.'');' <add> testString: 'assert($("h4").css("text-align") == "center", "Your code should use the text-align property on the <code>h4</code> tag to set it to center.");' <ide> - text: Your code should use the text-align property on the <code>p</code> tag to set it to justify. <del> testString: 'assert($(''p'').css(''text-align'') == ''justify'', ''Your code should use the text-align property on the <code>p</code> tag to set it to justify.'');' <add> testString: 'assert($("p").css("text-align") == "justify", "Your code should use the text-align property on the <code>p</code> tag to set it to justify.");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```html <ide> <style> <ide> h4 { <del> <add> <ide> } <ide> p { <del> <add> <ide> } <ide> .links { <ide> margin-right: 20px; <del> <add> <ide> } <ide> .fullCard { <ide> border: 1px solid #ccc; <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-visual-direction-by-fading-an-element-from-left-to-right.english.md <ide> Target the element with the id of <code>ball</code> and add the <code>opacity</c <ide> ```yml <ide> tests: <ide> - text: The <code>keyframes</code> rule for fade should set the <code>opacity</code> property to 0.1 at 50%. <del> testString: 'assert(code.match(/@keyframes fade\s*?{\s*?50%\s*?{\s*?(?:left:\s*?60%;\s*?opacity:\s*?0?\.1;|opacity:\s*?0?\.1;\s*?left:\s*?60%;)/gi), ''The <code>keyframes</code> rule for fade should set the <code>opacity</code> property to 0.1 at 50%.'');' <add> testString: 'assert(code.match(/@keyframes fade\s*?{\s*?50%\s*?{\s*?(?:left:\s*?60%;\s*?opacity:\s*?0?\.1;|opacity:\s*?0?\.1;\s*?left:\s*?60%;)/gi), "The <code>keyframes</code> rule for fade should set the <code>opacity</code> property to 0.1 at 50%.");' <ide> <ide> ``` <ide> <ide> tests: <ide> @keyframes fade { <ide> 50% { <ide> left: 60%; <del> <add> <ide> } <ide> } <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/decrease-the-opacity-of-an-element.english.md <ide> Set the <code>opacity</code> of the anchor tags to 0.7 using <code>links</code> <ide> ```yml <ide> tests: <ide> - text: Your code should set the <code>opacity</code> property to 0.7 on the anchor tags by selecting the class of <code>links</code>. <del> testString: 'assert.approximately(parseFloat($(''.links'').css(''opacity'')), 0.7, 0.1, ''Your code should set the <code>opacity</code> property to 0.7 on the anchor tags by selecting the class of <code>links</code>.'');' <add> testString: 'assert.approximately(parseFloat($(".links").css("opacity")), 0.7, 0.1, "Your code should set the <code>opacity</code> property to 0.7 on the anchor tags by selecting the class of <code>links</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> .links { <ide> text-align: left; <ide> color: black; <del> <add> <ide> } <ide> #thumbnail { <ide> box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23); <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/learn-about-complementary-colors.english.md <ide> Change the <code>background-color</code> property of the <code>blue</code> and < <ide> ```yml <ide> tests: <ide> - text: The <code>div</code> element with class <code>blue</code> should have a <code>background-color</code> of blue. <del> testString: 'assert($(''.blue'').css(''background-color'') == ''rgb(0, 0, 255)'', ''The <code>div</code> element with class <code>blue</code> should have a <code>background-color</code> of blue.'');' <add> testString: 'assert($(".blue").css("background-color") == "rgb(0, 0, 255)", "The <code>div</code> element with class <code>blue</code> should have a <code>background-color</code> of blue.");' <ide> - text: The <code>div</code> element with class <code>yellow</code> should have a <code>background-color</code> of yellow. <del> testString: 'assert($(''.yellow'').css(''background-color'') == ''rgb(255, 255, 0)'', ''The <code>div</code> element with class <code>yellow</code> should have a <code>background-color</code> of yellow.'');' <add> testString: 'assert($(".yellow").css("background-color") == "rgb(255, 255, 0)", "The <code>div</code> element with class <code>yellow</code> should have a <code>background-color</code> of yellow.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/learn-about-tertiary-colors.english.md <ide> Change the <code>background-color</code> property of the <code>orange</code>, <c <ide> ```yml <ide> tests: <ide> - text: The <code>div</code> element with class <code>orange</code> should have a <code>background-color</code> of orange. <del> testString: 'assert($(''.orange'').css(''background-color'') == ''rgb(255, 125, 0)'', ''The <code>div</code> element with class <code>orange</code> should have a <code>background-color</code> of orange.'');' <add> testString: 'assert($(".orange").css("background-color") == "rgb(255, 125, 0)", "The <code>div</code> element with class <code>orange</code> should have a <code>background-color</code> of orange.");' <ide> - text: The <code>div</code> element with class <code>cyan</code> should have a <code>background-color</code> of cyan. <del> testString: 'assert($(''.cyan'').css(''background-color'') == ''rgb(0, 255, 255)'', ''The <code>div</code> element with class <code>cyan</code> should have a <code>background-color</code> of cyan.'');' <add> testString: 'assert($(".cyan").css("background-color") == "rgb(0, 255, 255)", "The <code>div</code> element with class <code>cyan</code> should have a <code>background-color</code> of cyan.");' <ide> - text: The <code>div</code> element with class <code>raspberry</code> should have a <code>background-color</code> of raspberry. <del> testString: 'assert($(''.raspberry'').css(''background-color'') == ''rgb(255, 0, 125)'', ''The <code>div</code> element with class <code>raspberry</code> should have a <code>background-color</code> of raspberry.'');' <add> testString: 'assert($(".raspberry").css("background-color") == "rgb(255, 0, 125)", "The <code>div</code> element with class <code>raspberry</code> should have a <code>background-color</code> of raspberry.");' <ide> <ide> ``` <ide> <ide> tests: <ide> body { <ide> background-color: #FFFFFF; <ide> } <del> <add> <ide> .orange { <ide> background-color: #000000; <ide> } <del> <add> <ide> .cyan { <ide> background-color: #000000; <ide> } <del> <add> <ide> .raspberry { <ide> background-color: #000000; <ide> } <del> <add> <ide> div { <ide> height: 100px; <ide> width: 100px; <ide> margin-bottom: 5px; <ide> } <ide> </style> <del> <add> <ide> <div class="orange"></div> <ide> <div class="cyan"></div> <ide> <div class="raspberry"></div> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/learn-how-bezier-curves-work.english.md <ide> For the element with the id of <code>ball1</code>, change the value of the <code <ide> ```yml <ide> tests: <ide> - text: The value of the <code>animation-timing-function</code> property for the element with the id <code>ball1</code> should be the linear-equivalent cubic-bezier function. <del> testString: 'assert($(''#ball1'').css(''animation-timing-function'') == ''cubic-bezier(0.25, 0.25, 0.75, 0.75)'', ''The value of the <code>animation-timing-function</code> property for the element with the id <code>ball1</code> should be the linear-equivalent cubic-bezier function.'');' <add> testString: 'assert($("#ball1").css("animation-timing-function") == "cubic-bezier(0.25, 0.25, 0.75, 0.75)", "The value of the <code>animation-timing-function</code> property for the element with the id <code>ball1</code> should be the linear-equivalent cubic-bezier function.");' <ide> - text: The value of the <code>animation-timing-function</code> property for the element with the id <code>ball2</code> should not change. <del> testString: 'assert($(''#ball2'').css(''animation-timing-function'') == ''ease-out'', ''The value of the <code>animation-timing-function</code> property for the element with the id <code>ball2</code> should not change.'');' <add> testString: 'assert($("#ball2").css("animation-timing-function") == "ease-out", "The value of the <code>animation-timing-function</code> property for the element with the id <code>ball2</code> should not change.");' <ide> <ide> ``` <ide> <ide> tests: <ide> #ccffff, <ide> #ffcccc <ide> ); <del> position: fixed; <add> position: fixed; <ide> width: 50px; <ide> height: 50px; <ide> margin-top: 50px; <ide> animation-name: bounce; <ide> animation-duration: 2s; <ide> animation-iteration-count: infinite; <ide> } <del> #ball1 { <add> #ball1 { <ide> left: 27%; <ide> animation-timing-function: linear; <ide> } <del> #ball2 { <add> #ball2 { <ide> left: 56%; <ide> animation-timing-function: ease-out; <ide> } <ide> <ide> @keyframes bounce { <ide> 0% { <ide> top: 0px; <del> } <add> } <ide> 100% { <ide> top: 249px; <ide> } <del>} <add>} <ide> <ide> </style> <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/learn-how-the-css-keyframes-and-animation-properties-work.english.md <ide> Create an animation for the element with the id <code>rect</code>, by setting th <ide> ```yml <ide> tests: <ide> - text: The element with id of <code>rect</code> should have an <code>animation-name</code> property with a value of rainbow. <del> testString: 'assert($(''#rect'').css(''animation-name'') == ''rainbow'', ''The element with id of <code>rect</code> should have an <code>animation-name</code> property with a value of rainbow.'');' <add> testString: 'assert($("#rect").css("animation-name") == "rainbow", "The element with id of <code>rect</code> should have an <code>animation-name</code> property with a value of rainbow.");' <ide> - text: The element with id of <code>rect</code> should have an <code>animation-duration</code> property with a value of 4s. <del> testString: 'assert($(''#rect'').css(''animation-duration'') == ''4s'', ''The element with id of <code>rect</code> should have an <code>animation-duration</code> property with a value of 4s.'');' <add> testString: 'assert($("#rect").css("animation-duration") == "4s", "The element with id of <code>rect</code> should have an <code>animation-duration</code> property with a value of 4s.");' <ide> - text: The <code>@keyframes</code> rule should use the <code>animation-name</code> of rainbow. <del> testString: 'assert(code.match(/@keyframes\s+?rainbow\s*?{/g), ''The <code>@keyframes</code> rule should use the <code>animation-name</code> of rainbow.'');' <add> testString: 'assert(code.match(/@keyframes\s+?rainbow\s*?{/g), "The <code>@keyframes</code> rule should use the <code>animation-name</code> of rainbow.");' <ide> - text: The <code>@keyframes</code> rule for rainbow should use a <code>background-color</code> of blue at 0%. <del> testString: 'assert(code.match(/0%\s*?{\s*?background-color:\s*?blue;\s*?}/gi), ''The <code>@keyframes</code> rule for rainbow should use a <code>background-color</code> of blue at 0%.'');' <add> testString: 'assert(code.match(/0%\s*?{\s*?background-color:\s*?blue;\s*?}/gi), "The <code>@keyframes</code> rule for rainbow should use a <code>background-color</code> of blue at 0%.");' <ide> - text: The <code>@keyframes</code> rule for rainbow should use a <code>background-color</code> of green at 50%. <del> testString: 'assert(code.match(/50%\s*?{\s*?background-color:\s*?green;\s*?}/gi), ''The <code>@keyframes</code> rule for rainbow should use a <code>background-color</code> of green at 50%.'');' <add> testString: 'assert(code.match(/50%\s*?{\s*?background-color:\s*?green;\s*?}/gi), "The <code>@keyframes</code> rule for rainbow should use a <code>background-color</code> of green at 50%.");' <ide> - text: The <code>@keyframes</code> rule for rainbow should use a <code>background-color</code> of yellow at 100%. <del> testString: 'assert(code.match(/100%\s*?{\s*?background-color:\s*?yellow;\s*?}/gi), ''The <code>@keyframes</code> rule for rainbow should use a <code>background-color</code> of yellow at 100%.'');' <add> testString: 'assert(code.match(/100%\s*?{\s*?background-color:\s*?yellow;\s*?}/gi), "The <code>@keyframes</code> rule for rainbow should use a <code>background-color</code> of yellow at 100%.");' <ide> <ide> ``` <ide> <ide> tests: <ide> } <ide> <ide> #rect { <del> <del> <add> <add> <ide> } <del> <del> <del> <del> <add> <add> <add> <add> <ide> </style> <ide> <div id="rect"></div> <ide> ``` <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/lock-an-element-to-its-parent-with-absolute-positioning.english.md <ide> Lock the <code>#searchbar</code> element to the top-right of its <code>section</ <ide> ```yml <ide> tests: <ide> - text: 'The <code>#searchbar</code> element should have a <code>position</code> set to <code>absolute</code>.' <del> testString: 'assert($(''#searchbar'').css(''position'') == ''absolute'', ''The <code>#searchbar</code> element should have a <code>position</code> set to <code>absolute</code>.'');' <add> testString: 'assert($("#searchbar").css("position") == "absolute", "The <code>#searchbar</code> element should have a <code>position</code> set to <code>absolute</code>.");' <ide> - text: 'Your code should use the <code>top</code> CSS offset of 50 pixels on the <code>#searchbar</code> element.' <del> testString: 'assert($(''#searchbar'').css(''top'') == ''50px'', ''Your code should use the <code>top</code> CSS offset of 50 pixels on the <code>#searchbar</code> element.'');' <add> testString: 'assert($("#searchbar").css("top") == "50px", "Your code should use the <code>top</code> CSS offset of 50 pixels on the <code>#searchbar</code> element.");' <ide> - text: 'Your code should use the <code>right</code> CSS offset of 50 pixels on the <code>#searchbar</code> element.' <del> testString: 'assert($(''#searchbar'').css(''right'') == ''50px'', ''Your code should use the <code>right</code> CSS offset of 50 pixels on the <code>#searchbar</code> element.'');' <add> testString: 'assert($("#searchbar").css("right") == "50px", "Your code should use the <code>right</code> CSS offset of 50 pixels on the <code>#searchbar</code> element.");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```html <ide> <style> <ide> #searchbar { <del> <del> <del> <add> <add> <add> <ide> } <ide> section { <ide> position: relative; <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/lock-an-element-to-the-browser-window-with-fixed-positioning.english.md <ide> The navigation bar in the code is labeled with an id of <code>navbar</code>. Cha <ide> ```yml <ide> tests: <ide> - text: 'The <code>#navbar</code> element should have a <code>position</code> set to <code>fixed</code>.' <del> testString: 'assert($(''#navbar'').css(''position'') == ''fixed'', ''The <code>#navbar</code> element should have a <code>position</code> set to <code>fixed</code>.'');' <add> testString: 'assert($("#navbar").css("position") == "fixed", "The <code>#navbar</code> element should have a <code>position</code> set to <code>fixed</code>.");' <ide> - text: 'Your code should use the <code>top</code> CSS offset of 0 pixels on the <code>#navbar</code> element.' <del> testString: 'assert($(''#navbar'').css(''top'') == ''0px'', ''Your code should use the <code>top</code> CSS offset of 0 pixels on the <code>#navbar</code> element.'');' <add> testString: 'assert($("#navbar").css("top") == "0px", "Your code should use the <code>top</code> CSS offset of 0 pixels on the <code>#navbar</code> element.");' <ide> - text: 'Your code should use the <code>left</code> CSS offset of 0 pixels on the <code>#navbar</code> element.' <del> testString: 'assert($(''#navbar'').css(''left'') == ''0px'', ''Your code should use the <code>left</code> CSS offset of 0 pixels on the <code>#navbar</code> element.'');' <add> testString: 'assert($("#navbar").css("left") == "0px", "Your code should use the <code>left</code> CSS offset of 0 pixels on the <code>#navbar</code> element.");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```html <ide> <style> <ide> #navbar { <del> <del> <del> <add> <add> <add> <ide> width: 100%; <ide> background-color: #767676; <ide> } <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/make-a-css-heartbeat-using-an-infinite-animation-count.english.md <ide> Keep the heart beating by adding the <code>animation-iteration-count</code> prop <ide> ```yml <ide> tests: <ide> - text: The <code>animation-iteration-count</code> property for the <code>heart</code> class should have a value of infinite. <del> testString: 'assert($(''.heart'').css(''animation-iteration-count'') == ''infinite'', ''The <code>animation-iteration-count</code> property for the <code>heart</code> class should have a value of infinite.'');' <add> testString: 'assert($(".heart").css("animation-iteration-count") == "infinite", "The <code>animation-iteration-count</code> property for the <code>heart</code> class should have a value of infinite.");' <ide> - text: The <code>animation-iteration-count</code> property for the <code>back</code> class should have a value of infinite. <del> testString: 'assert($(''.back'').css(''animation-iteration-count'') == ''infinite'', ''The <code>animation-iteration-count</code> property for the <code>back</code> class should have a value of infinite.'');' <add> testString: 'assert($(".back").css("animation-iteration-count") == "infinite", "The <code>animation-iteration-count</code> property for the <code>back</code> class should have a value of infinite.");' <ide> <ide> ``` <ide> <ide> tests: <ide> height: 100%; <ide> background: white; <ide> animation-name: backdiv; <del> animation-duration: 1s; <del> <add> animation-duration: 1s; <add> <ide> } <ide> <ide> .heart { <ide> tests: <ide> transform: rotate(-45deg); <ide> animation-name: beat; <ide> animation-duration: 1s; <del> <add> <ide> } <ide> .heart:after { <ide> background-color: pink; <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/make-motion-more-natural-using-a-bezier-curve.english.md <ide> Change value of the <code>animation-timing-function</code> of the element with t <ide> ```yml <ide> tests: <ide> - text: 'The value of the <code>animation-timing-function</code> property for the element with the id <code>green</code> should be a <code>cubic-bezier</code> function with x1, y1, x2, y2 values as specified.' <del> testString: 'assert($(''#green'').css(''animation-timing-function'') == ''cubic-bezier(0.311, 0.441, 0.444, 1.649)'', ''The value of the <code>animation-timing-function</code> property for the element with the id <code>green</code> should be a <code>cubic-bezier</code> function with x1, y1, x2, y2 values as specified.'');' <add> testString: 'assert($("#green").css("animation-timing-function") == "cubic-bezier(0.311, 0.441, 0.444, 1.649)", "The value of the <code>animation-timing-function</code> property for the element with the id <code>green</code> should be a <code>cubic-bezier</code> function with x1, y1, x2, #{{TEXT}}' <ide> <ide> ``` <ide> <ide> tests: <ide> <style> <ide> .balls { <ide> border-radius: 50%; <del> position: fixed; <add> position: fixed; <ide> width: 50px; <ide> height: 50px; <ide> top: 60%; <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/modify-fill-mode-of-an-animation.english.md <ide> Set the <code>animation-fill-mode</code> property of <code>button:hover</code> t <ide> ```yml <ide> tests: <ide> - text: '<code>button:hover</code> should have a <code>animation-fill-mode</code> property with a value of <code>forwards</code>.' <del> testString: 'assert(code.match(/button\s*?:\s*?hover\s*?{[\s\S]*animation-fill-mode\s*?:\s*?forwards\s*?;[\s\S]*}/gi) && code.match(/button\s*?:\s*?hover\s*?{[\s\S]*animation-name\s*?:\s*?background-color\s*?;[\s\S]*}/gi) && code.match(/button\s*?:\s*?hover\s*?{[\s\S]*animation-duration\s*?:\s*?500ms\s*?;[\s\S]*}/gi), ''<code>button:hover</code> should have a <code>animation-fill-mode</code> property with a value of <code>forwards</code>.'');' <add> testString: 'assert(code.match(/button\s*?:\s*?hover\s*?{[\s\S]*animation-fill-mode\s*?:\s*?forwards\s*?;[\s\S]*}/gi) && code.match(/button\s*?:\s*?hover\s*?{[\s\S]*animation-name\s*?:\s*?background-color\s*?;[\s\S]*}/gi) && code.match(/button\s*?:\s*?hover\s*?{[\s\S]*animation-duration\s*?:\s*?500ms\s*?;[\s\S]*}/gi), "<code>button:hover</code> should have a <code>animation-fill-mode</code> property with a value of <code>forwards</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> animation-name: background-color; <ide> animation-duration: 500ms; <ide> /* add your code below this line */ <del> <add> <ide> /* add your code above this line */ <ide> } <ide> @keyframes background-color { <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/move-a-relatively-positioned-element-with-css-offsets.english.md <ide> videoUrl: 'https://scrimba.com/c/c9bQEA4' <ide> ## Description <ide> <section id='description'> <ide> The CSS offsets of <code>top</code> or <code>bottom</code>, and <code>left</code> or <code>right</code> tell the browser how far to offset an item relative to where it would sit in the normal flow of the document. You're offsetting an element away from a given spot, which moves the element away from the referenced side (effectively, the opposite direction). As you saw in the last challenge, using the top offset moved the <code>h2</code> downwards. Likewise, using a left offset moves an item to the right. <del><img src='https://i.imgur.com/eWWi3gZ.gif' alt='' /> <add><img src='https://i.imgur.com/eWWi3gZ.gif' alt=" /> <ide> </section> <ide> <ide> ## Instructions <ide> Use CSS offsets to move the <code>h2</code> 15 pixels to the right and 10 pixels <ide> ```yml <ide> tests: <ide> - text: 'Your code should use a CSS offset to relatively position the <code>h2</code> 10px upwards. In other words, move it 10px away from the <code>bottom</code> of where it normally sits.' <del> testString: 'assert($(''h2'').css(''bottom'') == ''10px'', ''Your code should use a CSS offset to relatively position the <code>h2</code> 10px upwards. In other words, move it 10px away from the <code>bottom</code> of where it normally sits.'');' <add> testString: 'assert($("h2").css("bottom") == "10px", "Your code should use a CSS offset to relatively position the <code>h2</code> 10px upwards. In other words, move it 10px away from the <code>bottom</code> of where it normally sits.");' <ide> - text: 'Your code should use a CSS offset to relatively position the <code>h2</code> 15px towards the right. In other words, move it 15px away from the <code>left</code> of where it normally sits.' <del> testString: 'assert($(''h2'').css(''left'') == ''15px'', ''Your code should use a CSS offset to relatively position the <code>h2</code> 15px towards the right. In other words, move it 15px away from the <code>left</code> of where it normally sits.'');' <add> testString: 'assert($("h2").css("left") == "15px", "Your code should use a CSS offset to relatively position the <code>h2</code> 15px towards the right. In other words, move it 15px away from the <code>left</code> of where it normally sits.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <style> <ide> h2 { <ide> position: relative; <del> <del> <add> <add> <ide> } <ide> </style> <ide> </head> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/push-elements-left-or-right-with-the-float-property.english.md <ide> The given markup would work well as a two-column layout, with the <code>section< <ide> ```yml <ide> tests: <ide> - text: The element with id <code>left</code> should have a <code>float</code> value of <code>left</code>. <del> testString: 'assert($(''#left'').css(''float'') == ''left'', ''The element with id <code>left</code> should have a <code>float</code> value of <code>left</code>.'');' <add> testString: 'assert($("#left").css("float") == "left", "The element with id <code>left</code> should have a <code>float</code> value of <code>left</code>.");' <ide> - text: The element with id <code>right</code> should have a <code>float</code> value of <code>right</code>. <del> testString: 'assert($(''#right'').css(''float'') == ''right'', ''The element with id <code>right</code> should have a <code>float</code> value of <code>right</code>.'');' <add> testString: 'assert($("#right").css("float") == "right", "The element with id <code>right</code> should have a <code>float</code> value of <code>right</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <head> <ide> <style> <ide> #left { <del> <add> <ide> width: 50%; <ide> } <ide> #right { <del> <add> <ide> width: 40%; <ide> } <ide> aside, section { <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/set-the-font-size-for-multiple-heading-elements.english.md <ide> The <code>font-size</code> property is used to specify how large the text is in <ide> ```yml <ide> tests: <ide> - text: Your code should set the <code>font-size</code> property for the <code>h1</code> tag to 68 pixels. <del> testString: 'assert($(''h1'').css(''font-size'') == ''68px'', ''Your code should set the <code>font-size</code> property for the <code>h1</code> tag to 68 pixels.'');' <add> testString: 'assert($("h1").css("font-size") == "68px", "Your code should set the <code>font-size</code> property for the <code>h1</code> tag to 68 pixels.");' <ide> - text: Your code should set the <code>font-size</code> property for the <code>h2</code> tag to 52 pixels. <del> testString: 'assert($(''h2'').css(''font-size'') == ''52px'', ''Your code should set the <code>font-size</code> property for the <code>h2</code> tag to 52 pixels.'');' <add> testString: 'assert($("h2").css("font-size") == "52px", "Your code should set the <code>font-size</code> property for the <code>h2</code> tag to 52 pixels.");' <ide> - text: Your code should set the <code>font-size</code> property for the <code>h3</code> tag to 40 pixels. <del> testString: 'assert($(''h3'').css(''font-size'') == ''40px'', ''Your code should set the <code>font-size</code> property for the <code>h3</code> tag to 40 pixels.'');' <add> testString: 'assert($("h3").css("font-size") == "40px", "Your code should set the <code>font-size</code> property for the <code>h3</code> tag to 40 pixels.");' <ide> - text: Your code should set the <code>font-size</code> property for the <code>h4</code> tag to 32 pixels. <del> testString: 'assert($(''h4'').css(''font-size'') == ''32px'', ''Your code should set the <code>font-size</code> property for the <code>h4</code> tag to 32 pixels.'');' <add> testString: 'assert($("h4").css("font-size") == "32px", "Your code should set the <code>font-size</code> property for the <code>h4</code> tag to 32 pixels.");' <ide> - text: Your code should set the <code>font-size</code> property for the <code>h5</code> tag to 21 pixels. <del> testString: 'assert($(''h5'').css(''font-size'') == ''21px'', ''Your code should set the <code>font-size</code> property for the <code>h5</code> tag to 21 pixels.'');' <add> testString: 'assert($("h5").css("font-size") == "21px", "Your code should set the <code>font-size</code> property for the <code>h5</code> tag to 21 pixels.");' <ide> - text: Your code should set the <code>font-size</code> property for the <code>h6</code> tag to 14 pixels. <del> testString: 'assert($(''h6'').css(''font-size'') == ''14px'', ''Your code should set the <code>font-size</code> property for the <code>h6</code> tag to 14 pixels.'');' <add> testString: 'assert($("h6").css("font-size") == "14px", "Your code should set the <code>font-size</code> property for the <code>h6</code> tag to 14 pixels.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <ide> ```html <ide> <style> <del> <del> <del> <del> <del> <del> <add> <add> <add> <add> <add> <add> <ide> </style> <ide> <h1>This is h1 text</h1> <ide> <h2>This is h2 text</h2> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/set-the-font-size-of-paragraph-text.english.md <ide> Change the value of the <code>font-size</code> property for the paragraph to 16p <ide> ```yml <ide> tests: <ide> - text: Your <code>p</code> tag should have a <code>font-size</code> of 16 pixels. <del> testString: 'assert($(''p'').css(''font-size'') == ''16px'', ''Your <code>p</code> tag should have a <code>font-size</code> of 16 pixels.'');' <add> testString: 'assert($("p").css("font-size") == "16px", "Your <code>p</code> tag should have a <code>font-size</code> of 16 pixels.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/set-the-font-weight-for-multiple-heading-elements.english.md <ide> The <code>font-weight</code> property sets how thick or thin characters are in a <ide> ```yml <ide> tests: <ide> - text: Your code should set the <code>font-weight</code> property for the <code>h1</code> tag to 800. <del> testString: 'assert($(''h1'').css(''font-weight'') == ''800'', ''Your code should set the <code>font-weight</code> property for the <code>h1</code> tag to 800.'');' <add> testString: 'assert($("h1").css("font-weight") == "800", "Your code should set the <code>font-weight</code> property for the <code>h1</code> tag to 800.");' <ide> - text: Your code should set the <code>font-weight</code> property for the <code>h2</code> tag to 600. <del> testString: 'assert($(''h2'').css(''font-weight'') == ''600'', ''Your code should set the <code>font-weight</code> property for the <code>h2</code> tag to 600.'');' <add> testString: 'assert($("h2").css("font-weight") == "600", "Your code should set the <code>font-weight</code> property for the <code>h2</code> tag to 600.");' <ide> - text: Your code should set the <code>font-weight</code> property for the <code>h3</code> tag to 500. <del> testString: 'assert($(''h3'').css(''font-weight'') == ''500'', ''Your code should set the <code>font-weight</code> property for the <code>h3</code> tag to 500.'');' <add> testString: 'assert($("h3").css("font-weight") == "500", "Your code should set the <code>font-weight</code> property for the <code>h3</code> tag to 500.");' <ide> - text: Your code should set the <code>font-weight</code> property for the <code>h4</code> tag to 400. <del> testString: 'assert($(''h4'').css(''font-weight'') == ''400'', ''Your code should set the <code>font-weight</code> property for the <code>h4</code> tag to 400.'');' <add> testString: 'assert($("h4").css("font-weight") == "400", "Your code should set the <code>font-weight</code> property for the <code>h4</code> tag to 400.");' <ide> - text: Your code should set the <code>font-weight</code> property for the <code>h5</code> tag to 300. <del> testString: 'assert($(''h5'').css(''font-weight'') == ''300'', ''Your code should set the <code>font-weight</code> property for the <code>h5</code> tag to 300.'');' <add> testString: 'assert($("h5").css("font-weight") == "300", "Your code should set the <code>font-weight</code> property for the <code>h5</code> tag to 300.");' <ide> - text: Your code should set the <code>font-weight</code> property for the <code>h6</code> tag to 200. <del> testString: 'assert($(''h6'').css(''font-weight'') == ''200'', ''Your code should set the <code>font-weight</code> property for the <code>h6</code> tag to 200.'');' <add> testString: 'assert($("h6").css("font-weight") == "200", "Your code should set the <code>font-weight</code> property for the <code>h6</code> tag to 200.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <style> <ide> h1 { <ide> font-size: 68px; <del> <add> <ide> } <ide> h2 { <ide> font-size: 52px; <del> <add> <ide> } <ide> h3 { <ide> font-size: 40px; <del> <add> <ide> } <ide> h4 { <ide> font-size: 32px; <del> <add> <ide> } <ide> h5 { <ide> font-size: 21px; <del> <add> <ide> } <ide> h6 { <ide> font-size: 14px; <del> <add> <ide> } <ide> </style> <ide> <h1>This is h1 text</h1> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/set-the-line-height-of-paragraphs.english.md <ide> Add a <code>line-height</code> property to the <code>p</code> tag and set it to <ide> ```yml <ide> tests: <ide> - text: Your code should set the <code>line-height</code> of the <code>p</code> tag to 25 pixels. <del> testString: 'assert($(''p'').css(''line-height'') == ''25px'', ''Your code should set the <code>line-height</code> of the <code>p</code> tag to 25 pixels.'');' <add> testString: 'assert($("p").css("line-height") == "25px", "Your code should set the <code>line-height</code> of the <code>p</code> tag to 25 pixels.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <style> <ide> p { <ide> font-size: 16px; <del> <add> <ide> } <ide> </style> <ide> <p> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-a-bezier-curve-to-move-a-graphic.english.md <ide> To see the effect of this Bezier curve in action, change the <code>animation-tim <ide> ```yml <ide> tests: <ide> - text: 'The value of the <code>animation-timing-function</code> property of the element with the id <code>red</code> should be a <code>cubic-bezier</code> function with x1, y1, x2, y2 values set respectively to 0, 0, 0.58, 1 .' <del> testString: 'assert($(''#red'').css(''animation-timing-function'') == ''cubic-bezier(0, 0, 0.58, 1)'', ''The value of the <code>animation-timing-function</code> property of the element with the id <code>red</code> should be a <code>cubic-bezier</code> function with x1, y1, x2, y2 values set respectively to 0, 0, 0.58, 1 .'');' <add> testString: 'assert($("#red").css("animation-timing-function") == "cubic-bezier(0, 0, 0.58, 1)", "The value of the <code>animation-timing-function</code> property of the element with the id <code>red</code> should be a <code>cubic-bezier</code> function with x1, y1, x2, y2 values set respectively to 0, 0, 0.58, 1 .");' <ide> - text: The element with the id <code>red</code> should no longer have the <code>animation-timing-function</code> property of linear. <del> testString: 'assert($(''#red'').css(''animation-timing-function'') !== ''linear'', ''The element with the id <code>red</code> should no longer have the <code>animation-timing-function</code> property of linear.'');' <add> testString: 'assert($("#red").css("animation-timing-function") !== "linear", "The element with the id <code>red</code> should no longer have the <code>animation-timing-function</code> property of linear.");' <ide> - text: The value of the <code>animation-timing-function</code> property for the element with the id <code>blue</code> should not change. <del> testString: 'assert($(''#blue'').css(''animation-timing-function'') == ''ease-out'', ''The value of the <code>animation-timing-function</code> property for the element with the id <code>blue</code> should not change.'');' <add> testString: 'assert($("#blue").css("animation-timing-function") == "ease-out", "The value of the <code>animation-timing-function</code> property for the element with the id <code>blue</code> should not change.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-a-css-linear-gradient-to-create-a-striped-element.english.md <ide> Make stripes by changing the <code>repeating-linear-gradient()</code> to use a g <ide> ```yml <ide> tests: <ide> - text: The angle of the <code>repeating-linear-gradient()</code> should be 45deg. <del> testString: 'assert(code.match(/background:\s*?repeating-linear-gradient\(\s*?45deg/gi), ''The angle of the <code>repeating-linear-gradient()</code> should be 45deg.'');' <add> testString: 'assert(code.match(/background:\s*?repeating-linear-gradient\(\s*?45deg/gi), "The angle of the <code>repeating-linear-gradient()</code> should be 45deg.");' <ide> - text: The angle of the <code>repeating-linear-gradient()</code> should no longer be 90deg <del> testString: 'assert(!code.match(/90deg/gi), ''The angle of the <code>repeating-linear-gradient()</code> should no longer be 90deg'');' <add> testString: 'assert(!code.match(/90deg/gi), "The angle of the <code>repeating-linear-gradient()</code> should no longer be 90deg");' <ide> - text: The color stop at 0 pixels should be <code>yellow</code>. <del> testString: 'assert(code.match(/yellow\s+?0(px)?/gi), ''The color stop at 0 pixels should be <code>yellow</code>.'');' <add> testString: 'assert(code.match(/yellow\s+?0(px)?/gi), "The color stop at 0 pixels should be <code>yellow</code>.");' <ide> - text: One color stop at 40 pixels should be <code>yellow</code>. <del> testString: 'assert(code.match(/yellow\s+?40px/gi), ''One color stop at 40 pixels should be <code>yellow</code>.'');' <add> testString: 'assert(code.match(/yellow\s+?40px/gi), "One color stop at 40 pixels should be <code>yellow</code>.");' <ide> - text: The second color stop at 40 pixels should be <code>black</code>. <del> testString: 'assert(code.match(/yellow\s+?40px,\s*?black\s+?40px/gi), ''The second color stop at 40 pixels should be <code>black</code>.'');' <add> testString: 'assert(code.match(/yellow\s+?40px,\s*?black\s+?40px/gi), "The second color stop at 40 pixels should be <code>black</code>.");' <ide> - text: The last color stop at 80 pixels should be <code>black</code>. <del> testString: 'assert(code.match(/black\s+?80px/gi), ''The last color stop at 80 pixels should be <code>black</code>.'');' <add> testString: 'assert(code.match(/black\s+?80px/gi), "The last color stop at 80 pixels should be <code>black</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```html <ide> <style> <ide> <del> div{ <add> div{ <ide> border-radius: 20px; <ide> width: 70%; <ide> height: 400px; <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-css-animation-to-change-the-hover-state-of-a-button.english.md <ide> Use CSS <code>@keyframes</code> to change the <code>background-color</code> of t <ide> ```yml <ide> tests: <ide> - text: The @keyframes rule should use the <code>animation-name</code> background-color. <del> testString: 'assert(code.match(/@keyframes\s+?background-color\s*?{/g), ''The @keyframes rule should use the <code>animation-name</code> background-color.'');' <add> testString: 'assert(code.match(/@keyframes\s+?background-color\s*?{/g), "The @keyframes rule should use the <code>animation-name</code> background-color.");' <ide> - text: 'There should be one rule under <code>@keyframes</code> that changes the <code>background-color</code> to <code>#4791d0</code> at 100%.' <del> testString: 'assert(code.match(/100%\s*?{\s*?background-color:\s*?#4791d0;\s*?}/gi), ''There should be one rule under <code>@keyframes</code> that changes the <code>background-color</code> to <code>#4791d0</code> at 100%.'');' <add> testString: 'assert(code.match(/100%\s*?{\s*?background-color:\s*?#4791d0;\s*?}/gi), "There should be one rule under <code>@keyframes</code> that changes the <code>background-color</code> to <code>#4791d0</code> at 100%.");' <ide> <ide> ``` <ide> <ide> tests: <ide> background-color: #0F5897; <ide> padding: 5px 10px 8px 10px; <ide> } <del> <add> <ide> button:hover { <ide> animation-name: background-color; <ide> animation-duration: 500ms; <ide> } <del> <del> <add> <add> <ide> </style> <del> <add> <ide> <button>Register</button> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-the-css-transform-property-skewx-to-skew-an-element-along-the-x-axis.english.md <ide> Skew the element with the id of <code>bottom</code> by 24 degrees along the X-ax <ide> ```yml <ide> tests: <ide> - text: The element with id <code>bottom</code> should be skewed by 24 degrees along its X-axis. <del> testString: 'assert(code.match(/#bottom\s*?{\s*?.*?\s*?transform:\s*?skewX\(24deg\);/g), ''The element with id <code>bottom</code> should be skewed by 24 degrees along its X-axis.'');' <add> testString: 'assert(code.match(/#bottom\s*?{\s*?.*?\s*?transform:\s*?skewX\(24deg\);/g), "The element with id <code>bottom</code> should be skewed by 24 degrees along its X-axis.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <ide> ```html <ide> <style> <del> div { <add> div { <ide> width: 70%; <ide> height: 100px; <ide> margin: 50px auto; <ide> tests: <ide> } <ide> #bottom { <ide> background-color: blue; <del> <add> <ide> } <ide> </style> <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-the-css-transform-property-skewy-to-skew-an-element-along-the-y-axis.english.md <ide> Skew the element with the id of <code>top</code> -10 degrees along the Y-axis by <ide> ```yml <ide> tests: <ide> - text: The element with id <code>top</code> should be skewed by -10 degrees along its Y-axis. <del> testString: 'assert(code.match(/#top\s*?{\s*?.*?\s*?transform:\s*?skewY\(-10deg\);/g), ''The element with id <code>top</code> should be skewed by -10 degrees along its Y-axis.'');' <add> testString: 'assert(code.match(/#top\s*?{\s*?.*?\s*?transform:\s*?skewY\(-10deg\);/g), "The element with id <code>top</code> should be skewed by -10 degrees along its Y-axis.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <ide> ```html <ide> <style> <del> div { <add> div { <ide> width: 70%; <ide> height: 100px; <ide> margin: 50px auto; <ide> } <ide> #top { <ide> background-color: red; <del> <add> <ide> } <ide> #bottom { <ide> background-color: blue; <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-the-css-transform-scale-property-to-change-the-size-of-an-element.english.md <ide> Increase the size of the element with the id of <code>ball2</code> to 1.5 times <ide> ```yml <ide> tests: <ide> - text: 'Set the <code>transform</code> property for <code>#ball2</code> to scale it 1.5 times its size.' <del> testString: 'assert(code.match(/#ball2\s*?{\s*?left:\s*?65%;\s*?transform:\s*?scale\(1\.5\);\s*?}|#ball2\s*?{\s*?transform:\s*?scale\(1\.5\);\s*?left:\s*?65%;\s*?}/gi), ''Set the <code>transform</code> property for <code>#ball2</code> to scale it 1.5 times its size.'');' <add> testString: 'assert(code.match(/#ball2\s*?{\s*?left:\s*?65%;\s*?transform:\s*?scale\(1\.5\);\s*?}|#ball2\s*?{\s*?transform:\s*?scale\(1\.5\);\s*?left:\s*?65%;\s*?}/gi), "Set the <code>transform</code> property for <code>#ball2</code> to scale it 1.5 times its size.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <ide> ```html <ide> <style> <del> .ball { <add> .ball { <ide> width: 40px; <ide> height: 40px; <ide> margin: 50 auto; <ide> tests: <ide> } <ide> #ball2 { <ide> left: 65%; <del> <add> <ide> } <ide> <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-the-css-transform-scale-property-to-scale-an-element-on-hover.english.md <ide> Add a CSS rule for the <code>hover</code> state of the <code>div</code> and use <ide> ```yml <ide> tests: <ide> - text: The size of the <code>div</code> element should scale 1.1 times when the user hovers over it. <del> testString: 'assert(code.match(/div:hover\s*?{\s*?transform:\s*?scale\(1\.1\);/gi), ''The size of the <code>div</code> element should scale 1.1 times when the user hovers over it.'');' <add> testString: 'assert(code.match(/div:hover\s*?{\s*?transform:\s*?scale\(1\.1\);/gi), "The size of the <code>div</code> element should scale 1.1 times when the user hovers over it.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <ide> ```html <ide> <style> <del> div { <add> div { <ide> width: 70%; <ide> height: 100px; <ide> margin: 50px auto; <ide> tests: <ide> #ffcccf <ide> ); <ide> } <del> <del> <del> <add> <add> <add> <ide> </style> <ide> <ide> <div></div> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-the-em-tag-to-italicize-text.english.md <ide> Wrap an <code>em</code> tag around the contents of the paragraph tag to give it <ide> ```yml <ide> tests: <ide> - text: Your code should add an <code>em</code> tag to the markup. <del> testString: 'assert($(''em'').length == 1, ''Your code should add an <code>em</code> tag to the markup.'');' <add> testString: 'assert($("em").length == 1, "Your code should add an <code>em</code> tag to the markup.");' <ide> - text: The <code>em</code> tag should wrap around the contents of the <code>p</code> tag but not the <code>p</code> tag itself. <del> testString: 'assert($(''p'').children().length == 1 && $(''em'').children().length == 2, ''The <code>em</code> tag should wrap around the contents of the <code>p</code> tag but not the <code>p</code> tag itself.'');' <add> testString: 'assert($("p").children().length == 1 && $("em").children().length == 2, "The <code>em</code> tag should wrap around the contents of the <code>p</code> tag but not the <code>p</code> tag itself.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-the-s-tag-to-strikethrough-text.english.md <ide> id: 587d781b367417b2b2512aba <ide> title: Use the s Tag to Strikethrough Text <ide> challengeType: 0 <del>videoUrl: '' <add>videoUrl: " <ide> --- <ide> <ide> ## Description <ide> Wrap the <code>s</code> tag around "Google" inside the <code>h4</code> tag and t <ide> ```yml <ide> tests: <ide> - text: Your code should add one <code>s</code> tag to the markup. <del> testString: 'assert($(''s'').length == 1, ''Your code should add one <code>s</code> tag to the markup.'');' <add> testString: 'assert($("s").length == 1, "Your code should add one <code>s</code> tag to the markup.");' <ide> - text: A <code>s</code> tag should wrap around the Google text in the <code>h4</code> tag. It should not contain the word Alphabet. <del> testString: 'assert($(''s'').text().match(/Google/gi) && !$(''s'').text().match(/Alphabet/gi), ''A <code>s</code> tag should wrap around the Google text in the <code>h4</code> tag. It should not contain the word Alphabet.'');' <add> testString: 'assert($("s").text().match(/Google/gi) && !$("s").text().match(/Alphabet/gi), "A <code>s</code> tag should wrap around the Google text in the <code>h4</code> tag. It should not contain the word Alphabet.");' <ide> - text: 'Include the word Alphabet in the <code>h4</code> tag, without strikethrough formatting.' <del> testString: 'assert($(''h4'').html().match(/Alphabet/gi), ''Include the word Alphabet in the <code>h4</code> tag, without strikethrough formatting.'');' <add> testString: 'assert($("h4").html().match(/Alphabet/gi), "Include the word Alphabet in the <code>h4</code> tag, without strikethrough formatting.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-the-strong-tag-to-make-text-bold.english.md <ide> Wrap a <code>strong</code> tag around "Stanford University" inside the <code>p</ <ide> ```yml <ide> tests: <ide> - text: Your code should add one <code>strong</code> tag to the markup. <del> testString: 'assert($(''strong'').length == 1, ''Your code should add one <code>strong</code> tag to the markup.'');' <add> testString: 'assert($("strong").length == 1, "Your code should add one <code>strong</code> tag to the markup.");' <ide> - text: The <code>strong</code> tag should be inside the <code>p</code> tag. <del> testString: 'assert($(''p'').children(''strong'').length == 1, ''The <code>strong</code> tag should be inside the <code>p</code> tag.'');' <add> testString: 'assert($("p").children("strong").length == 1, "The <code>strong</code> tag should be inside the <code>p</code> tag.");' <ide> - text: The <code>strong</code> tag should wrap around the words "Stanford University". <del> testString: 'assert($(''strong'').text().match(/^Stanford University$/gi), ''The <code>strong</code> tag should wrap around the words "Stanford University".'');' <add> testString: 'assert($("strong").text().match(/^Stanford University$/gi), "The <code>strong</code> tag should wrap around the words "Stanford University".");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-the-text-transform-property-to-make-text-uppercase.english.md <ide> Transform the text of the <code>h4</code> to be uppercase using the <code>text-t <ide> ```yml <ide> tests: <ide> - text: The <code>h4</code> text should be uppercase. <del> testString: 'assert($(''h4'').css(''text-transform'') === ''uppercase'', ''The <code>h4</code> text should be uppercase.'');' <add> testString: 'assert($("h4").css("text-transform") === "uppercase", "The <code>h4</code> text should be uppercase.");' <ide> - text: The original text of the h4 should not be changed. <del> testString: 'assert(($(''h4'').text() !== $(''h4'').text().toUpperCase()), ''The original text of the h4 should not be changed.'');' <add> testString: 'assert(($("h4").text() !== $("h4").text().toUpperCase()), "The original text of the h4 should not be changed.");' <ide> <ide> ``` <ide> <ide> tests: <ide> background-color: rgba(45, 45, 45, 0.1); <ide> padding: 10px; <ide> font-size: 27px; <del> <add> <ide> } <ide> p { <ide> text-align: justify; <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-the-u-tag-to-underline-text.english.md <ide> Wrap the <code>u</code> tag only around the text "Ph.D. students". <ide> ```yml <ide> tests: <ide> - text: Your code should add a <code>u</code> tag to the markup. <del> testString: 'assert($(''u'').length === 1, ''Your code should add a <code>u</code> tag to the markup.'');' <add> testString: 'assert($("u").length === 1, "Your code should add a <code>u</code> tag to the markup.");' <ide> - text: The <code>u</code> tag should wrap around the text "Ph.D. students". <del> testString: 'assert($(''u'').text() === ''Ph.D. students'', ''The <code>u</code> tag should wrap around the text "Ph.D. students".'');' <add> testString: 'assert($("u").text() === "Ph.D. students", "The <code>u</code> tag should wrap around the text "Ph.D. students".");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/add-a-negative-margin-to-an-element.english.md <ide> Change the <code>margin</code> of the blue box to <code>-15px</code>, so it fill <ide> ```yml <ide> tests: <ide> - text: Your <code>blue-box</code> class should give elements <code>-15px</code> of <code>margin</code>. <del> testString: 'assert($(".blue-box").css("margin-top") === "-15px", ''Your <code>blue-box</code> class should give elements <code>-15px</code> of <code>margin</code>.'');' <add> testString: 'assert($(".blue-box").css("margin-top") === "-15px", "Your <code>blue-box</code> class should give elements <code>-15px</code> of <code>margin</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> background-color: yellow; <ide> padding: 10px; <ide> } <del> <add> <ide> .red-box { <ide> background-color: crimson; <ide> color: #fff; <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/add-borders-around-your-elements.english.md <ide> Remember that you can apply multiple classes to an element using its <code>class <ide> ```yml <ide> tests: <ide> - text: Your <code>img</code> element should have the class <code>smaller-image</code>. <del> testString: 'assert($("img").hasClass("smaller-image"), ''Your <code>img</code> element should have the class <code>smaller-image</code>.'');' <add> testString: 'assert($("img").hasClass("smaller-image"), "Your <code>img</code> element should have the class <code>smaller-image</code>.");' <ide> - text: Your <code>img</code> element should have the class <code>thick-green-border</code>. <del> testString: 'assert($("img").hasClass("thick-green-border"), ''Your <code>img</code> element should have the class <code>thick-green-border</code>.'');' <add> testString: 'assert($("img").hasClass("thick-green-border"), "Your <code>img</code> element should have the class <code>thick-green-border</code>.");' <ide> - text: Give your image a border width of <code>10px</code>. <del> testString: 'assert($("img").hasClass("thick-green-border") && parseInt($("img").css("border-top-width"), 10) >= 8 && parseInt($("img").css("border-top-width"), 10) <= 12, ''Give your image a border width of <code>10px</code>.'');' <add> testString: 'assert($("img").hasClass("thick-green-border") && parseInt($("img").css("border-top-width"), 10) >= 8 && parseInt($("img").css("border-top-width"), 10) <= 12, "Give your image a border width of <code>10px</code>.");' <ide> - text: Give your image a border style of <code>solid</code>. <del> testString: 'assert($("img").css("border-right-style") === "solid", ''Give your image a border style of <code>solid</code>.'');' <add> testString: 'assert($("img").css("border-right-style") === "solid", "Give your image a border style of <code>solid</code>.");' <ide> - text: The border around your <code>img</code> element should be green. <del> testString: 'assert($("img").css("border-left-color") === "rgb(0, 128, 0)", ''The border around your <code>img</code> element should be green.'');' <add> testString: 'assert($("img").css("border-left-color") === "rgb(0, 128, 0)", "The border around your <code>img</code> element should be green.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2 class="red-text">CatPhotoApp</h2> <ide> <main> <ide> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img class="smaller-image" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <div> <ide> <p>Things cats love:</p> <ide> <ul> <ide> tests: <ide> <li>other cats</li> <ide> </ol> <ide> </div> <del> <add> <ide> <form action="/submit-cat-photo"> <ide> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <ide> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/add-different-margins-to-each-side-of-an-element.english.md <ide> Give the blue box a <code>margin</code> of <code>40px</code> on its top and left <ide> ```yml <ide> tests: <ide> - text: Your <code>blue-box</code> class should give the top of elements <code>40px</code> of <code>margin</code>. <del> testString: 'assert($(".blue-box").css("margin-top") === "40px", ''Your <code>blue-box</code> class should give the top of elements <code>40px</code> of <code>margin</code>.'');' <add> testString: 'assert($(".blue-box").css("margin-top") === "40px", "Your <code>blue-box</code> class should give the top of elements <code>40px</code> of <code>margin</code>.");' <ide> - text: Your <code>blue-box</code> class should give the right of elements <code>20px</code> of <code>margin</code>. <del> testString: 'assert($(".blue-box").css("margin-right") === "20px", ''Your <code>blue-box</code> class should give the right of elements <code>20px</code> of <code>margin</code>.'');' <add> testString: 'assert($(".blue-box").css("margin-right") === "20px", "Your <code>blue-box</code> class should give the right of elements <code>20px</code> of <code>margin</code>.");' <ide> - text: Your <code>blue-box</code> class should give the bottom of elements <code>20px</code> of <code>margin</code>. <del> testString: 'assert($(".blue-box").css("margin-bottom") === "20px", ''Your <code>blue-box</code> class should give the bottom of elements <code>20px</code> of <code>margin</code>.'');' <add> testString: 'assert($(".blue-box").css("margin-bottom") === "20px", "Your <code>blue-box</code> class should give the bottom of elements <code>20px</code> of <code>margin</code>.");' <ide> - text: Your <code>blue-box</code> class should give the left of elements <code>40px</code> of <code>margin</code>. <del> testString: 'assert($(".blue-box").css("margin-left") === "40px", ''Your <code>blue-box</code> class should give the left of elements <code>40px</code> of <code>margin</code>.'');' <add> testString: 'assert($(".blue-box").css("margin-left") === "40px", "Your <code>blue-box</code> class should give the left of elements <code>40px</code> of <code>margin</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> background-color: yellow; <ide> padding: 10px; <ide> } <del> <add> <ide> .red-box { <ide> background-color: crimson; <ide> color: #fff; <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/add-different-padding-to-each-side-of-an-element.english.md <ide> Give the blue box a <code>padding</code> of <code>40px</code> on its top and lef <ide> ```yml <ide> tests: <ide> - text: Your <code>blue-box</code> class should give the top of the elements <code>40px</code> of <code>padding</code>. <del> testString: 'assert($(".blue-box").css("padding-top") === "40px", ''Your <code>blue-box</code> class should give the top of the elements <code>40px</code> of <code>padding</code>.'');' <add> testString: 'assert($(".blue-box").css("padding-top") === "40px", "Your <code>blue-box</code> class should give the top of the elements <code>40px</code> of <code>padding</code>.");' <ide> - text: Your <code>blue-box</code> class should give the right of the elements <code>20px</code> of <code>padding</code>. <del> testString: 'assert($(".blue-box").css("padding-right") === "20px", ''Your <code>blue-box</code> class should give the right of the elements <code>20px</code> of <code>padding</code>.'');' <add> testString: 'assert($(".blue-box").css("padding-right") === "20px", "Your <code>blue-box</code> class should give the right of the elements <code>20px</code> of <code>padding</code>.");' <ide> - text: Your <code>blue-box</code> class should give the bottom of the elements <code>20px</code> of <code>padding</code>. <del> testString: 'assert($(".blue-box").css("padding-bottom") === "20px", ''Your <code>blue-box</code> class should give the bottom of the elements <code>20px</code> of <code>padding</code>.'');' <add> testString: 'assert($(".blue-box").css("padding-bottom") === "20px", "Your <code>blue-box</code> class should give the bottom of the elements <code>20px</code> of <code>padding</code>.");' <ide> - text: Your <code>blue-box</code> class should give the left of the elements <code>40px</code> of <code>padding</code>. <del> testString: 'assert($(".blue-box").css("padding-left") === "40px", ''Your <code>blue-box</code> class should give the left of the elements <code>40px</code> of <code>padding</code>.'');' <add> testString: 'assert($(".blue-box").css("padding-left") === "40px", "Your <code>blue-box</code> class should give the left of the elements <code>40px</code> of <code>padding</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> background-color: yellow; <ide> padding: 10px; <ide> } <del> <add> <ide> .red-box { <ide> background-color: crimson; <ide> color: #fff; <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/add-rounded-corners-with-border-radius.english.md <ide> Note: this challenge allows for multiple possible solutions. For example, you ma <ide> ```yml <ide> tests: <ide> - text: Your image element should have the class "thick-green-border". <del> testString: 'assert($("img").hasClass("thick-green-border"), ''Your image element should have the class "thick-green-border".'');' <add> testString: 'assert($("img").hasClass("thick-green-border"), "Your image element should have the class "thick-green-border".");' <ide> - text: Your image should have a border radius of <code>10px</code> <del> testString: 'assert(parseInt($("img").css("border-top-left-radius")) > 8, ''Your image should have a border radius of <code>10px</code>'');' <add> testString: 'assert(parseInt($("img").css("border-top-left-radius")) > 8, "Your image should have a border radius of <code>10px</code>");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2 class="red-text">CatPhotoApp</h2> <ide> <main> <ide> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <div> <ide> <p>Things cats love:</p> <ide> <ul> <ide> tests: <ide> <li>other cats</li> <ide> </ol> <ide> </div> <del> <add> <ide> <form action="/submit-cat-photo"> <ide> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <ide> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/adjust-the-margin-of-an-element.english.md <ide> Change the <code>margin</code> of the blue box to match that of the red box. <ide> ```yml <ide> tests: <ide> - text: Your <code>blue-box</code> class should give elements <code>20px</code> of <code>margin</code>. <del> testString: 'assert($(".blue-box").css("margin-top") === "20px", ''Your <code>blue-box</code> class should give elements <code>20px</code> of <code>margin</code>.'');' <add> testString: 'assert($(".blue-box").css("margin-top") === "20px", "Your <code>blue-box</code> class should give elements <code>20px</code> of <code>margin</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> background-color: yellow; <ide> padding: 10px; <ide> } <del> <add> <ide> .red-box { <ide> background-color: crimson; <ide> color: #fff; <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/adjust-the-padding-of-an-element.english.md <ide> Change the <code>padding</code> of your blue box to match that of your red box. <ide> ```yml <ide> tests: <ide> - text: Your <code>blue-box</code> class should give elements <code>20px</code> of <code>padding</code>. <del> testString: 'assert($(".blue-box").css("padding-top") === "20px", ''Your <code>blue-box</code> class should give elements <code>20px</code> of <code>padding</code>.'');' <add> testString: 'assert($(".blue-box").css("padding-top") === "20px", "Your <code>blue-box</code> class should give elements <code>20px</code> of <code>padding</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> background-color: yellow; <ide> padding: 10px; <ide> } <del> <add> <ide> .red-box { <ide> background-color: crimson; <ide> color: #fff; <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/attach-a-fallback-value-to-a-css-variable.english.md <ide> It looks there is a problem with the variables supplied to the <code>.penguin-to <ide> ```yml <ide> tests: <ide> - text: Apply the fallback value of <code>black</code> to the <code>background</code> property of the <code>penguin-top</code> class. <del> testString: 'assert(code.match(/.penguin-top\s*?{[\s\S]*background\s*?:\s*?var\(\s*?--pengiun-skin\s*?,\s*?black\s*?\)\s*?;[\s\S]*}[\s\S]*.penguin-bottom\s{/gi), ''Apply the fallback value of <code>black</code> to the <code>background</code> property of the <code>penguin-top</code> class.'');' <add> testString: 'assert(code.match(/.penguin-top\s*?{[\s\S]*background\s*?:\s*?var\(\s*?--pengiun-skin\s*?,\s*?black\s*?\)\s*?;[\s\S]*}[\s\S]*.penguin-bottom\s{/gi), "Apply the fallback value of <code>black</code> to the <code>background</code> property of the <code>penguin-top</code> class.");' <ide> - text: Apply the fallback value of <code>black</code> to the <code>background</code> property of the <code>penguin-bottom</code> class. <del> testString: 'assert(code.match(/.penguin-bottom\s*?{[\s\S]*background\s*?:\s*?var\(\s*?--pengiun-skin\s*?,\s*?black\s*?\)\s*?;[\s\S]*}/gi), ''Apply the fallback value of <code>black</code> to the <code>background</code> property of the <code>penguin-bottom</code> class.'');' <add> testString: 'assert(code.match(/.penguin-bottom\s*?{[\s\S]*background\s*?:\s*?var\(\s*?--pengiun-skin\s*?,\s*?black\s*?\)\s*?;[\s\S]*}/gi), "Apply the fallback value of <code>black</code> to the <code>background</code> property of the <code>penguin-bottom</code> class.");' <ide> <ide> ``` <ide> <ide> tests: <ide> width: 300px; <ide> height: 300px; <ide> } <del> <add> <ide> .penguin-top { <ide> top: 10%; <ide> left: 25%; <del> <add> <ide> /* change code below */ <ide> background: var(--pengiun-skin); <ide> /* change code above */ <del> <add> <ide> width: 50%; <ide> height: 45%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .penguin-bottom { <ide> top: 40%; <ide> left: 23.5%; <del> <add> <ide> /* change code below */ <ide> background: var(--pengiun-skin); <ide> /* change code above */ <del> <add> <ide> width: 53%; <ide> height: 45%; <ide> border-radius: 70% 70% 100% 100%; <ide> } <del> <add> <ide> .right-hand { <ide> top: 0%; <ide> left: -5%; <ide> tests: <ide> transform: rotate(45deg); <ide> z-index: -1; <ide> } <del> <add> <ide> .left-hand { <ide> top: 0%; <ide> left: 75%; <ide> tests: <ide> transform: rotate(-45deg); <ide> z-index: -1; <ide> } <del> <add> <ide> .right-cheek { <ide> top: 15%; <ide> left: 35%; <ide> tests: <ide> height: 70%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .left-cheek { <ide> top: 15%; <ide> left: 5%; <ide> tests: <ide> height: 70%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .belly { <ide> top: 60%; <ide> left: 2.5%; <ide> tests: <ide> height: 100%; <ide> border-radius: 120% 120% 100% 100%; <ide> } <del> <add> <ide> .right-feet { <ide> top: 85%; <ide> left: 60%; <ide> tests: <ide> transform: rotate(-80deg); <ide> z-index: -2222; <ide> } <del> <add> <ide> .left-feet { <ide> top: 85%; <ide> left: 25%; <ide> tests: <ide> transform: rotate(80deg); <ide> z-index: -2222; <ide> } <del> <add> <ide> .right-eye { <ide> top: 45%; <ide> left: 60%; <ide> tests: <ide> height: 17%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .left-eye { <ide> top: 45%; <ide> left: 25%; <ide> tests: <ide> height: 17%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .sparkle { <ide> top: 25%; <ide> left: 15%; <ide> tests: <ide> height: 35%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .blush-right { <ide> top: 65%; <ide> left: 15%; <ide> tests: <ide> height: 10%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .blush-left { <ide> top: 65%; <ide> left: 70%; <ide> tests: <ide> height: 10%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .beak-top { <ide> top: 60%; <ide> left: 40%; <ide> tests: <ide> height: 10%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .beak-bottom { <ide> top: 65%; <ide> left: 42%; <ide> tests: <ide> height: 10%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> body { <ide> background:#c6faf1; <ide> } <del> <add> <ide> .penguin * { <ide> position: absolute; <ide> } <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/cascading-css-variables.english.md <ide> Define a variable named <code>--penguin-belly</code> in the <code>:root</code> s <ide> ```yml <ide> tests: <ide> - text: 'declare the <code>--penguin-belly</code> variable in the <code>:root</code> and assign it to <code>pink</code>.' <del> testString: 'assert(code.match(/:root\s*?{[\s\S]*--penguin-belly\s*?:\s*?pink\s*?;[\s\S]*}/gi), ''declare the <code>--penguin-belly</code> variable in the <code>:root</code> and assign it to <code>pink</code>.'');' <add> testString: 'assert(code.match(/:root\s*?{[\s\S]*--penguin-belly\s*?:\s*?pink\s*?;[\s\S]*}/gi), "declare the <code>--penguin-belly</code> variable in the <code>:root</code> and assign it to <code>pink</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```html <ide> <style> <ide> :root { <del> <add> <ide> /* add code below */ <del> <add> <ide> /* add code above */ <ide> } <del> <add> <ide> body { <ide> background: var(--penguin-belly, #c6faf1); <ide> } <del> <add> <ide> .penguin { <ide> --penguin-skin: gray; <ide> --penguin-beak: orange; <ide> tests: <ide> width: 300px; <ide> height: 300px; <ide> } <del> <add> <ide> .right-cheek { <ide> top: 15%; <ide> left: 35%; <ide> tests: <ide> height: 70%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .left-cheek { <ide> top: 15%; <ide> left: 5%; <ide> tests: <ide> height: 70%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .belly { <ide> top: 60%; <ide> left: 2.5%; <ide> tests: <ide> height: 100%; <ide> border-radius: 120% 120% 100% 100%; <ide> } <del> <add> <ide> .penguin-top { <ide> top: 10%; <ide> left: 25%; <ide> tests: <ide> height: 45%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .penguin-bottom { <ide> top: 40%; <ide> left: 23.5%; <ide> tests: <ide> height: 45%; <ide> border-radius: 70% 70% 100% 100%; <ide> } <del> <add> <ide> .right-hand { <ide> top: 0%; <ide> left: -5%; <ide> tests: <ide> transform: rotate(45deg); <ide> z-index: -1; <ide> } <del> <add> <ide> .left-hand { <ide> top: 0%; <ide> left: 75%; <ide> tests: <ide> transform: rotate(-45deg); <ide> z-index: -1; <ide> } <del> <add> <ide> .right-feet { <ide> top: 85%; <ide> left: 60%; <ide> tests: <ide> transform: rotate(-80deg); <ide> z-index: -2222; <ide> } <del> <add> <ide> .left-feet { <ide> top: 85%; <ide> left: 25%; <ide> tests: <ide> transform: rotate(80deg); <ide> z-index: -2222; <ide> } <del> <add> <ide> .right-eye { <ide> top: 45%; <ide> left: 60%; <ide> tests: <ide> height: 17%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .left-eye { <ide> top: 45%; <ide> left: 25%; <ide> tests: <ide> height: 17%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .sparkle { <ide> top: 25%; <ide> left: 15%; <ide> tests: <ide> height: 35%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .blush-right { <ide> top: 65%; <ide> left: 15%; <ide> tests: <ide> height: 10%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .blush-left { <ide> top: 65%; <ide> left: 70%; <ide> tests: <ide> height: 10%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .beak-top { <ide> top: 60%; <ide> left: 40%; <ide> tests: <ide> height: 10%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .beak-bottom { <ide> top: 65%; <ide> left: 42%; <ide> tests: <ide> height: 10%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .penguin * { <ide> position: absolute; <ide> } <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/change-a-variable-for-a-specific-area.english.md <ide> Change the value of <code>--penguin-belly</code> to <code>white</code> in the <c <ide> ```yml <ide> tests: <ide> - text: The <code>penguin</code> class should reassign the <code>--penguin-belly</code> variable to <code>white</code>. <del> testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-belly\s*?:\s*?white\s*?;[\s\S]*}/gi), ''The <code>penguin</code> class should reassign the <code>--penguin-belly</code> variable to <code>white</code>.'');' <add> testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-belly\s*?:\s*?white\s*?;[\s\S]*}/gi), "The <code>penguin</code> class should reassign the <code>--penguin-belly</code> variable to <code>white</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> --penguin-belly: pink; <ide> --penguin-beak: orange; <ide> } <del> <add> <ide> body { <ide> background: var(--penguin-belly, #c6faf1); <ide> } <del> <add> <ide> .penguin { <del> <add> <ide> /* add code below */ <del> <add> <ide> /* add code above */ <del> <add> <ide> position: relative; <ide> margin: auto; <ide> display: block; <ide> margin-top: 5%; <ide> width: 300px; <ide> height: 300px; <ide> } <del> <add> <ide> .right-cheek { <ide> top: 15%; <ide> left: 35%; <ide> tests: <ide> height: 70%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .left-cheek { <ide> top: 15%; <ide> left: 5%; <ide> tests: <ide> height: 70%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .belly { <ide> top: 60%; <ide> left: 2.5%; <ide> tests: <ide> height: 100%; <ide> border-radius: 120% 120% 100% 100%; <ide> } <del> <add> <ide> .penguin-top { <ide> top: 10%; <ide> left: 25%; <ide> tests: <ide> height: 45%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .penguin-bottom { <ide> top: 40%; <ide> left: 23.5%; <ide> tests: <ide> height: 45%; <ide> border-radius: 70% 70% 100% 100%; <ide> } <del> <add> <ide> .right-hand { <ide> top: 0%; <ide> left: -5%; <ide> tests: <ide> transform: rotate(45deg); <ide> z-index: -1; <ide> } <del> <add> <ide> .left-hand { <ide> top: 0%; <ide> left: 75%; <ide> tests: <ide> transform: rotate(-45deg); <ide> z-index: -1; <ide> } <del> <add> <ide> .right-feet { <ide> top: 85%; <ide> left: 60%; <ide> tests: <ide> transform: rotate(-80deg); <ide> z-index: -2222; <ide> } <del> <add> <ide> .left-feet { <ide> top: 85%; <ide> left: 25%; <ide> tests: <ide> transform: rotate(80deg); <ide> z-index: -2222; <ide> } <del> <add> <ide> .right-eye { <ide> top: 45%; <ide> left: 60%; <ide> tests: <ide> height: 17%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .left-eye { <ide> top: 45%; <ide> left: 25%; <ide> tests: <ide> height: 17%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .sparkle { <ide> top: 25%; <ide> left: 15%; <ide> tests: <ide> height: 35%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .blush-right { <ide> top: 65%; <ide> left: 15%; <ide> tests: <ide> height: 10%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .blush-left { <ide> top: 65%; <ide> left: 70%; <ide> tests: <ide> height: 10%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .beak-top { <ide> top: 60%; <ide> left: 40%; <ide> tests: <ide> height: 10%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .beak-bottom { <ide> top: 65%; <ide> left: 42%; <ide> tests: <ide> height: 10%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .penguin * { <ide> position: absolute; <ide> } <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/change-the-color-of-text.english.md <ide> Change your <code>h2</code> element's style so that its text color is red. <ide> ```yml <ide> tests: <ide> - text: Your <code>h2</code> element should be red. <del> testString: 'assert($("h2").css("color") === "rgb(255, 0, 0)", ''Your <code>h2</code> element should be red.'');' <add> testString: 'assert($("h2").css("color") === "rgb(255, 0, 0)", "Your <code>h2</code> element should be red.");' <ide> - text: Your <code>style</code> declaration should end with a <code>;</code> . <del> testString: 'assert(code.match(/<h2\s+style\s*=\s*(\''|")\s*color\s*:\s*(?:rgb\(\s*255\s*,\s*0\s*,\s*0\s*\)|rgb\(\s*100%\s*,\s*0%\s*,\s*0%\s*\)|red|#ff0000|#f00|hsl\(\s*0\s*,\s*100%\s*,\s*50%\s*\))\s*\;(\''|")>\s*CatPhotoApp\s*<\/h2>/),'' Your <code>style</code> declaration should end with a <code>;</code> .'');' <add> testString: 'assert(code.match(/<h2\s+style\s*=\s*(\"|")\s*color\s*:\s*(?:rgb\(\s*255\s*,\s*0\s*,\s*0\s*\)|rgb\(\s*100%\s*,\s*0%\s*,\s*0%\s*\)|red|#ff0000|#f00|hsl\(\s*0\s*,\s*100%\s*,\s*50%\s*\))\s*\;(\"|")>\s*CatPhotoApp\s*<\/h2>/)," Your <code>style</code> declaration should end with a <code>;</code> .");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2>CatPhotoApp</h2> <ide> <main> <ide> <p>Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <div> <ide> <p>Things cats love:</p> <ide> <ul> <ide> tests: <ide> <li>other cats</li> <ide> </ol> <ide> </div> <del> <add> <ide> <form action="/submit-cat-photo"> <ide> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <ide> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/change-the-font-size-of-an-element.english.md <ide> Inside the same <code>&#60;style&#62;</code> tag that contains your <code>red-te <ide> ```yml <ide> tests: <ide> - text: 'Between the <code>style</code> tags, give the <code>p</code> elements <code>font-size</code> of <code>16px</code>. Browser and Text zoom should be at 100%.' <del> testString: 'assert(code.match(/p\s*{\s*font-size\s*:\s*16\s*px\s*;\s*}/i), ''Between the <code>style</code> tags, give the <code>p</code> elements <code>font-size</code> of <code>16px</code>. Browser and Text zoom should be at 100%.'');' <add> testString: 'assert(code.match(/p\s*{\s*font-size\s*:\s*16\s*px\s*;\s*}/i), "Between the <code>style</code> tags, give the <code>p</code> elements <code>font-size</code> of <code>16px</code>. Browser and Text zoom should be at 100%.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2 class="red-text">CatPhotoApp</h2> <ide> <main> <ide> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <div> <ide> <p>Things cats love:</p> <ide> <ul> <ide> tests: <ide> <li>other cats</li> <ide> </ol> <ide> </div> <del> <add> <ide> <form action="/submit-cat-photo"> <ide> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <ide> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/create-a-custom-css-variable.english.md <ide> In the <code>penguin</code> class, create a variable name <code>--penguin-skin</ <ide> ```yml <ide> tests: <ide> - text: <code>penguin</code> class should declare the <code>--penguin-skin</code> variable and assign it to <code>gray</code>. <del> testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-skin\s*?:\s*?gray\s*?;[\s\S]*}/gi), ''<code>penguin</code> class should declare the <code>--penguin-skin</code> variable and assign it to <code>gray</code>.'');' <add> testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-skin\s*?:\s*?gray\s*?;[\s\S]*}/gi), "<code>penguin</code> class should declare the <code>--penguin-skin</code> variable and assign it to <code>gray</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```html <ide> <style> <ide> .penguin { <del> <add> <ide> /* add code below */ <del> <add> <ide> /* add code above */ <ide> position: relative; <ide> margin: auto; <ide> tests: <ide> width: 300px; <ide> height: 300px; <ide> } <del> <add> <ide> .penguin-top { <ide> top: 10%; <ide> left: 25%; <ide> tests: <ide> height: 45%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .penguin-bottom { <ide> top: 40%; <ide> left: 23.5%; <ide> tests: <ide> height: 45%; <ide> border-radius: 70% 70% 100% 100%; <ide> } <del> <add> <ide> .right-hand { <ide> top: 0%; <ide> left: -5%; <ide> tests: <ide> transform: rotate(45deg); <ide> z-index: -1; <ide> } <del> <add> <ide> .left-hand { <ide> top: 0%; <ide> left: 75%; <ide> tests: <ide> transform: rotate(-45deg); <ide> z-index: -1; <ide> } <del> <add> <ide> .right-cheek { <ide> top: 15%; <ide> left: 35%; <ide> tests: <ide> height: 70%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .left-cheek { <ide> top: 15%; <ide> left: 5%; <ide> tests: <ide> height: 70%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .belly { <ide> top: 60%; <ide> left: 2.5%; <ide> tests: <ide> height: 100%; <ide> border-radius: 120% 120% 100% 100%; <ide> } <del> <add> <ide> .right-feet { <ide> top: 85%; <ide> left: 60%; <ide> tests: <ide> height: 30%; <ide> border-radius: 50% 50% 50% 50%; <ide> transform: rotate(-80deg); <del> z-index: -2222; <add> z-index: -2222; <ide> } <del> <add> <ide> .left-feet { <ide> top: 85%; <ide> left: 25%; <ide> tests: <ide> height: 30%; <ide> border-radius: 50% 50% 50% 50%; <ide> transform: rotate(80deg); <del> z-index: -2222; <add> z-index: -2222; <ide> } <del> <add> <ide> .right-eye { <ide> top: 45%; <ide> left: 60%; <ide> background: black; <ide> width: 15%; <ide> height: 17%; <del> border-radius: 50%; <add> border-radius: 50%; <ide> } <del> <add> <ide> .left-eye { <ide> top: 45%; <ide> left: 25%; <ide> background: black; <ide> width: 15%; <ide> height: 17%; <del> border-radius: 50%; <add> border-radius: 50%; <ide> } <del> <add> <ide> .sparkle { <ide> top: 25%; <ide> left: 15%; <ide> background: white; <ide> width: 35%; <ide> height: 35%; <del> border-radius: 50%; <add> border-radius: 50%; <ide> } <del> <add> <ide> .blush-right { <ide> top: 65%; <ide> left: 15%; <ide> background: pink; <ide> width: 15%; <ide> height: 10%; <del> border-radius: 50%; <add> border-radius: 50%; <ide> } <del> <add> <ide> .blush-left { <ide> top: 65%; <ide> left: 70%; <ide> background: pink; <ide> width: 15%; <ide> height: 10%; <del> border-radius: 50%; <add> border-radius: 50%; <ide> } <del> <add> <ide> .beak-top { <ide> top: 60%; <ide> left: 40%; <ide> background: orange; <ide> width: 20%; <ide> height: 10%; <del> border-radius: 50%; <add> border-radius: 50%; <ide> } <del> <add> <ide> .beak-bottom { <ide> top: 65%; <ide> left: 42%; <ide> background: orange; <ide> width: 16%; <ide> height: 10%; <del> border-radius: 50%; <add> border-radius: 50%; <ide> } <del> <add> <ide> body { <ide> background:#c6faf1; <ide> } <del> <add> <ide> .penguin * { <ide> position: absolute; <ide> } <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/give-a-background-color-to-a-div-element.english.md <ide> Create a class called <code>silver-background</code> with the <code>background-c <ide> ```yml <ide> tests: <ide> - text: Give your <code>div</code> element the class <code>silver-background</code>. <del> testString: 'assert($("div").hasClass("silver-background"), ''Give your <code>div</code> element the class <code>silver-background</code>.'');' <add> testString: 'assert($("div").hasClass("silver-background"), "Give your <code>div</code> element the class <code>silver-background</code>.");' <ide> - text: Your <code>div</code> element should have a silver background. <del> testString: 'assert($("div").css("background-color") === "rgb(192, 192, 192)", ''Your <code>div</code> element should have a silver background.'');' <add> testString: 'assert($("div").css("background-color") === "rgb(192, 192, 192)", "Your <code>div</code> element should have a silver background.");' <ide> - text: Define a class named <code>silver-background</code> within the <code>style</code> element and assign the value of <code>silver</code> to the <code>background-color</code> property. <ide> testString: 'assert(code.match(/\.silver-background\s*{\s*background-color:\s*silver;\s*}/), "Define a class named <code>silver-background</code> within the <code>style</code> element and assign the value of <code>silver</code> to the <code>background-color</code> property.");' <ide> <ide> tests: <ide> <h2 class="red-text">CatPhotoApp</h2> <ide> <main> <ide> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <div> <ide> <p>Things cats love:</p> <ide> <ul> <ide> tests: <ide> <li>other cats</li> <ide> </ol> <ide> </div> <del> <add> <ide> <form action="/submit-cat-photo"> <ide> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <ide> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/import-a-google-font.english.md <ide> Create a <code>font-family</code> CSS rule that uses the <code>Lobster</code> fo <ide> ```yml <ide> tests: <ide> - text: Import the <code>Lobster</code> font. <del> testString: 'assert(new RegExp("googleapis", "gi").test(code), ''Import the <code>Lobster</code> font.'');' <add> testString: 'assert(new RegExp("googleapis", "gi").test(code), "Import the <code>Lobster</code> font.");' <ide> - text: Your <code>h2</code> element should use the font <code>Lobster</code>. <del> testString: 'assert($("h2").css("font-family").match(/lobster/i), ''Your <code>h2</code> element should use the font <code>Lobster</code>.'');' <add> testString: 'assert($("h2").css("font-family").match(/lobster/i), "Your <code>h2</code> element should use the font <code>Lobster</code>.");' <ide> - text: Use an <code>h2</code> CSS selector to change the font. <del> testString: 'assert(/\s*h2\s*\{\s*font-family\:\s*(\''|")?Lobster(\''|")?\s*;\s*\}/gi.test(code), ''Use an <code>h2</code> CSS selector to change the font.'');' <add> testString: 'assert(/\s*h2\s*\{\s*font-family\:\s*(\"|")?Lobster(\"|")?\s*;\s*\}/gi.test(code), "Use an <code>h2</code> CSS selector to change the font.");' <ide> - text: Your <code>p</code> element should still use the font <code>monospace</code>. <del> testString: 'assert($("p").css("font-family").match(/monospace/i), ''Your <code>p</code> element should still use the font <code>monospace</code>.'');' <add> testString: 'assert($("p").css("font-family").match(/monospace/i), "Your <code>p</code> element should still use the font <code>monospace</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2 class="red-text">CatPhotoApp</h2> <ide> <main> <ide> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <div> <ide> <p>Things cats love:</p> <ide> <ul> <ide> tests: <ide> <li>other cats</li> <ide> </ol> <ide> </div> <del> <add> <ide> <form action="/submit-cat-photo"> <ide> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <ide> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/improve-compatibility-with-browser-fallbacks.english.md <ide> id: 5b7d72c338cd7e35b63f3e14 <ide> title: Improve Compatibility with Browser Fallbacks <ide> challengeType: 0 <del>videoUrl: '' <add>videoUrl: " <ide> --- <ide> <ide> ## Description <ide> It looks like a variable is being used to set the background color of the <code> <ide> ```yml <ide> tests: <ide> - text: Your <code>.red-box</code> rule should include a fallback with the <code>background</code> set to red immediately before the existing <code>background</code> declaration. <del> testString: 'assert(code.match(/.red-box\s*{[^}]*background:\s*(red|#ff0000|#f00|rgb\(\s*255\s*,\s*0\s*,\s*0\s*\)|rgb\(\s*100%\s*,\s*0%\s*,\s*0%\s*\)|hsl\(\s*0\s*,\s*100%\s*,\s*50%\s*\))\s*;\s*background:\s*var\(\s*--red-color\s*\);/gi), ''Your <code>.red-box</code> rule should include a fallback with the <code>background</code> set to red immediately before the existing <code>background</code> declaration.'');' <add> testString: 'assert(code.match(/.red-box\s*{[^}]*background:\s*(red|#ff0000|#f00|rgb\(\s*255\s*,\s*0\s*,\s*0\s*\)|rgb\(\s*100%\s*,\s*0%\s*,\s*0%\s*\)|hsl\(\s*0\s*,\s*100%\s*,\s*50%\s*\))\s*;\s*background:\s*var\(\s*--red-color\s*\);/gi), "Your <code>.red-box</code> rule should include a fallback with the <code>background</code> set to red immediately before the existing <code>background</code> declaration.");' <ide> <ide> ``` <ide> <ide> tests: <ide> --red-color: red; <ide> } <ide> .red-box { <del> <add> <ide> background: var(--red-color); <ide> height: 200px; <ide> width:200px; <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/inherit-styles-from-the-body-element.english.md <ide> Finally, give your <code>body</code> element the font-family of <code>monospace< <ide> ```yml <ide> tests: <ide> - text: Create an <code>h1</code> element. <del> testString: 'assert(($("h1").length > 0), ''Create an <code>h1</code> element.'');' <add> testString: 'assert(($("h1").length > 0), "Create an <code>h1</code> element.");' <ide> - text: Your <code>h1</code> element should have the text <code>Hello World</code>. <del> testString: 'assert(($("h1").length > 0 && $("h1").text().match(/hello world/i)), ''Your <code>h1</code> element should have the text <code>Hello World</code>.'');' <add> testString: 'assert(($("h1").length > 0 && $("h1").text().match(/hello world/i)), "Your <code>h1</code> element should have the text <code>Hello World</code>.");' <ide> - text: Make sure your <code>h1</code> element has a closing tag. <del> testString: 'assert(code.match(/<\/h1>/g) && code.match(/<h1/g) && code.match(/<\/h1>/g).length === code.match(/<h1/g).length, ''Make sure your <code>h1</code> element has a closing tag.'');' <add> testString: 'assert(code.match(/<\/h1>/g) && code.match(/<h1/g) && code.match(/<\/h1>/g).length === code.match(/<h1/g).length, "Make sure your <code>h1</code> element has a closing tag.");' <ide> - text: Give your <code>body</code> element the <code>color</code> property of <code>green</code>. <del> testString: 'assert(($("body").css("color") === "rgb(0, 128, 0)"), ''Give your <code>body</code> element the <code>color</code> property of <code>green</code>.'');' <add> testString: 'assert(($("body").css("color") === "rgb(0, 128, 0)"), "Give your <code>body</code> element the <code>color</code> property of <code>green</code>.");' <ide> - text: Give your <code>body</code> element the <code>font-family</code> property of <code>monospace</code>. <del> testString: 'assert(($("body").css("font-family").match(/monospace/i)), ''Give your <code>body</code> element the <code>font-family</code> property of <code>monospace</code>.'');' <add> testString: 'assert(($("body").css("font-family").match(/monospace/i)), "Give your <code>body</code> element the <code>font-family</code> property of <code>monospace</code>.");' <ide> - text: Your <code>h1</code> element should inherit the font <code>monospace</code> from your <code>body</code> element. <del> testString: 'assert(($("h1").length > 0 && $("h1").css("font-family").match(/monospace/i)), ''Your <code>h1</code> element should inherit the font <code>monospace</code> from your <code>body</code> element.'');' <add> testString: 'assert(($("h1").length > 0 && $("h1").css("font-family").match(/monospace/i)), "Your <code>h1</code> element should inherit the font <code>monospace</code> from your <code>body</code> element.");' <ide> - text: Your <code>h1</code> element should inherit the color green from your <code>body</code> element. <del> testString: 'assert(($("h1").length > 0 && $("h1").css("color") === "rgb(0, 128, 0)"), ''Your <code>h1</code> element should inherit the color green from your <code>body</code> element.'');' <add> testString: 'assert(($("h1").length > 0 && $("h1").css("color") === "rgb(0, 128, 0)"), "Your <code>h1</code> element should inherit the color green from your <code>body</code> element.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/make-circular-images-with-a-border-radius.english.md <ide> Give your cat photo a <code>border-radius</code> of <code>50%</code>. <ide> ```yml <ide> tests: <ide> - text: 'Your image should have a border radius of <code>50%</code>, making it perfectly circular.' <del> testString: 'assert(parseInt($("img").css("border-top-left-radius")) > 48, ''Your image should have a border radius of <code>50%</code>, making it perfectly circular.'');' <add> testString: 'assert(parseInt($("img").css("border-top-left-radius")) > 48, "Your image should have a border radius of <code>50%</code>, making it perfectly circular.");' <ide> - text: Be sure to use a percentage value of <code>50%</code>. <del> testString: 'assert(code.match(/50%/g), ''Be sure to use a percentage value of <code>50%</code>.'');' <add> testString: 'assert(code.match(/50%/g), "Be sure to use a percentage value of <code>50%</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2 class="red-text">CatPhotoApp</h2> <ide> <main> <ide> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <div> <ide> <p>Things cats love:</p> <ide> <ul> <ide> tests: <ide> <li>other cats</li> <ide> </ol> <ide> </div> <del> <add> <ide> <form action="/submit-cat-photo"> <ide> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <ide> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/override-all-other-styles-by-using-important.english.md <ide> An example of how to do this is: <ide> ```yml <ide> tests: <ide> - text: Your <code>h1</code> element should have the class <code>pink-text</code>. <del> testString: 'assert($("h1").hasClass("pink-text"), ''Your <code>h1</code> element should have the class <code>pink-text</code>.'');' <add> testString: 'assert($("h1").hasClass("pink-text"), "Your <code>h1</code> element should have the class <code>pink-text</code>.");' <ide> - text: Your <code>h1</code> element should have the class <code>blue-text</code>. <del> testString: 'assert($("h1").hasClass("blue-text"), ''Your <code>h1</code> element should have the class <code>blue-text</code>.'');' <add> testString: 'assert($("h1").hasClass("blue-text"), "Your <code>h1</code> element should have the class <code>blue-text</code>.");' <ide> - text: Your <code>h1</code> element should have the id of <code>orange-text</code>. <del> testString: 'assert($("h1").attr("id") === "orange-text", ''Your <code>h1</code> element should have the id of <code>orange-text</code>.'');' <add> testString: 'assert($("h1").attr("id") === "orange-text", "Your <code>h1</code> element should have the id of <code>orange-text</code>.");' <ide> - text: 'Your <code>h1</code> element should have the inline style of <code>color&#58; white</code>.' <del> testString: 'assert(code.match(/<h1.*style/gi) && code.match(/<h1.*style.*color\s*?:/gi), ''Your <code>h1</code> element should have the inline style of <code>color&#58; white</code>.'');' <add> testString: 'assert(code.match(/<h1.*style/gi) && code.match(/<h1.*style.*color\s*?:/gi), "Your <code>h1</code> element should have the inline style of <code>color&#58; white</code>.");' <ide> - text: Your <code>pink-text</code> class declaration should have the <code>!important</code> keyword to override all other declarations. <del> testString: 'assert(code.match(/\.pink-text\s*?\{[\s\S]*?color:.*pink.*!important\s*;?[^\.]*\}/g), ''Your <code>pink-text</code> class declaration should have the <code>!important</code> keyword to override all other declarations.'');' <add> testString: 'assert(code.match(/\.pink-text\s*?\{[\s\S]*?color:.*pink.*!important\s*;?[^\.]*\}/g), "Your <code>pink-text</code> class declaration should have the <code>!important</code> keyword to override all other declarations.");' <ide> - text: Your <code>h1</code> element should be pink. <del> testString: 'assert($("h1").css("color") === "rgb(255, 192, 203)", ''Your <code>h1</code> element should be pink.'');' <add> testString: 'assert($("h1").css("color") === "rgb(255, 192, 203)", "Your <code>h1</code> element should be pink.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/override-class-declarations-by-styling-id-attributes.english.md <ide> Note: It doesn't matter whether you declare this CSS above or below pink-text cl <ide> ```yml <ide> tests: <ide> - text: Your <code>h1</code> element should have the class <code>pink-text</code>. <del> testString: 'assert($("h1").hasClass("pink-text"), ''Your <code>h1</code> element should have the class <code>pink-text</code>.'');' <add> testString: 'assert($("h1").hasClass("pink-text"), "Your <code>h1</code> element should have the class <code>pink-text</code>.");' <ide> - text: Your <code>h1</code> element should have the class <code>blue-text</code>. <del> testString: 'assert($("h1").hasClass("blue-text"), ''Your <code>h1</code> element should have the class <code>blue-text</code>.'');' <add> testString: 'assert($("h1").hasClass("blue-text"), "Your <code>h1</code> element should have the class <code>blue-text</code>.");' <ide> - text: Give your <code>h1</code> element the id of <code>orange-text</code>. <del> testString: 'assert($("h1").attr("id") === "orange-text", ''Give your <code>h1</code> element the id of <code>orange-text</code>.'');' <add> testString: 'assert($("h1").attr("id") === "orange-text", "Give your <code>h1</code> element the id of <code>orange-text</code>.");' <ide> - text: There should be only one <code>h1</code> element. <del> testString: 'assert(($("h1").length === 1), ''There should be only one <code>h1</code> element.'');' <add> testString: 'assert(($("h1").length === 1), "There should be only one <code>h1</code> element.");' <ide> - text: Create a CSS declaration for your <code>orange-text</code> id <del> testString: 'assert(code.match(/#orange-text\s*{/gi), ''Create a CSS declaration for your <code>orange-text</code> id'');' <add> testString: 'assert(code.match(/#orange-text\s*{/gi), "Create a CSS declaration for your <code>orange-text</code> id");' <ide> - text: Do not give your <code>h1</code> any <code>style</code> attributes. <del> testString: 'assert(!code.match(/<h1.*style.*>/gi), ''Do not give your <code>h1</code> any <code>style</code> attributes.'');' <add> testString: 'assert(!code.match(/<h1.*style.*>/gi), "Do not give your <code>h1</code> any <code>style</code> attributes.");' <ide> - text: Your <code>h1</code> element should be orange. <del> testString: 'assert($("h1").css("color") === "rgb(255, 165, 0)", ''Your <code>h1</code> element should be orange.'');' <add> testString: 'assert($("h1").css("color") === "rgb(255, 165, 0)", "Your <code>h1</code> element should be orange.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/override-class-declarations-with-inline-styles.english.md <ide> Leave the <code>blue-text</code> and <code>pink-text</code> classes on your <cod <ide> ```yml <ide> tests: <ide> - text: Your <code>h1</code> element should have the class <code>pink-text</code>. <del> testString: 'assert($("h1").hasClass("pink-text"), ''Your <code>h1</code> element should have the class <code>pink-text</code>.'');' <add> testString: 'assert($("h1").hasClass("pink-text"), "Your <code>h1</code> element should have the class <code>pink-text</code>.");' <ide> - text: Your <code>h1</code> element should have the class <code>blue-text</code>. <del> testString: 'assert($("h1").hasClass("blue-text"), ''Your <code>h1</code> element should have the class <code>blue-text</code>.'');' <add> testString: 'assert($("h1").hasClass("blue-text"), "Your <code>h1</code> element should have the class <code>blue-text</code>.");' <ide> - text: Your <code>h1</code> element should have the id of <code>orange-text</code>. <del> testString: 'assert($("h1").attr("id") === "orange-text", ''Your <code>h1</code> element should have the id of <code>orange-text</code>.'');' <add> testString: 'assert($("h1").attr("id") === "orange-text", "Your <code>h1</code> element should have the id of <code>orange-text</code>.");' <ide> - text: Give your <code>h1</code> element an inline style. <del> testString: 'assert(document.querySelector(''h1[style]''), ''Give your <code>h1</code> element an inline style.'');' <add> testString: 'assert(document.querySelector("h1[style]"), "Give your <code>h1</code> element an inline style.");' <ide> - text: Your <code>h1</code> element should be white. <del> testString: 'assert($("h1").css("color") === "rgb(255, 255, 255)", ''Your <code>h1</code> element should be white.'');' <add> testString: 'assert($("h1").css("color") === "rgb(255, 255, 255)", "Your <code>h1</code> element should be white.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/override-styles-in-subsequent-css.english.md <ide> However, the order of the <code>class</code> declarations in the <code>&#60;styl <ide> ```yml <ide> tests: <ide> - text: Your <code>h1</code> element should have the class <code>pink-text</code>. <del> testString: 'assert($("h1").hasClass("pink-text"), ''Your <code>h1</code> element should have the class <code>pink-text</code>.'');' <add> testString: 'assert($("h1").hasClass("pink-text"), "Your <code>h1</code> element should have the class <code>pink-text</code>.");' <ide> - text: Your <code>h1</code> element should have the class <code>blue-text</code>. <del> testString: 'assert($("h1").hasClass("blue-text"), ''Your <code>h1</code> element should have the class <code>blue-text</code>.'');' <add> testString: 'assert($("h1").hasClass("blue-text"), "Your <code>h1</code> element should have the class <code>blue-text</code>.");' <ide> - text: Both <code>blue-text</code> and <code>pink-text</code> should belong to the same <code>h1</code> element. <del> testString: 'assert($(".pink-text").hasClass("blue-text"), ''Both <code>blue-text</code> and <code>pink-text</code> should belong to the same <code>h1</code> element.'');' <add> testString: 'assert($(".pink-text").hasClass("blue-text"), "Both <code>blue-text</code> and <code>pink-text</code> should belong to the same <code>h1</code> element.");' <ide> - text: Your <code>h1</code> element should be blue. <del> testString: 'assert($("h1").css("color") === "rgb(0, 0, 255)", ''Your <code>h1</code> element should be blue.'');' <add> testString: 'assert($("h1").css("color") === "rgb(0, 0, 255)", "Your <code>h1</code> element should be blue.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/prioritize-one-style-over-another.english.md <ide> Give your <code>h1</code> element the class of <code>pink-text</code>. <ide> ```yml <ide> tests: <ide> - text: Your <code>h1</code> element should have the class <code>pink-text</code>. <del> testString: 'assert($("h1").hasClass("pink-text"), ''Your <code>h1</code> element should have the class <code>pink-text</code>.'');' <add> testString: 'assert($("h1").hasClass("pink-text"), "Your <code>h1</code> element should have the class <code>pink-text</code>.");' <ide> - text: 'Your <code>&#60;style&#62;</code> should have a <code>pink-text</code> CSS class that changes the <code>color</code>.' <del> testString: 'assert(code.match(/\.pink-text\s*\{\s*color\s*:\s*.+\s*;\s*\}/g), ''Your <code>&#60;style&#62;</code> should have a <code>pink-text</code> CSS class that changes the <code>color</code>.'');' <add> testString: 'assert(code.match(/\.pink-text\s*\{\s*color\s*:\s*.+\s*;\s*\}/g), "Your <code>&#60;style&#62;</code> should have a <code>pink-text</code> CSS class that changes the <code>color</code>.");' <ide> - text: Your <code>h1</code> element should be pink. <del> testString: 'assert($("h1").css("color") === "rgb(255, 192, 203)", ''Your <code>h1</code> element should be pink.'');' <add> testString: 'assert($("h1").css("color") === "rgb(255, 192, 203)", "Your <code>h1</code> element should be pink.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/set-the-font-family-of-an-element.english.md <ide> Make all of your <code>p</code> elements use the <code>monospace</code> font. <ide> ```yml <ide> tests: <ide> - text: Your <code>p</code> elements should use the font <code>monospace</code>. <del> testString: 'assert($("p").not(".red-text").css("font-family").match(/monospace/i), ''Your <code>p</code> elements should use the font <code>monospace</code>.'');' <add> testString: 'assert($("p").not(".red-text").css("font-family").match(/monospace/i), "Your <code>p</code> elements should use the font <code>monospace</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2 class="red-text">CatPhotoApp</h2> <ide> <main> <ide> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <div> <ide> <p>Things cats love:</p> <ide> <ul> <ide> tests: <ide> <li>other cats</li> <ide> </ol> <ide> </div> <del> <add> <ide> <form action="/submit-cat-photo"> <ide> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <ide> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/set-the-id-of-an-element.english.md <ide> Give your <code>form</code> element the id <code>cat-photo-form</code>. <ide> ```yml <ide> tests: <ide> - text: Give your <code>form</code> element the id of <code>cat-photo-form</code>. <del> testString: 'assert($("form").attr("id") === "cat-photo-form", ''Give your <code>form</code> element the id of <code>cat-photo-form</code>.'');' <add> testString: 'assert($("form").attr("id") === "cat-photo-form", "Give your <code>form</code> element the id of <code>cat-photo-form</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2 class="red-text">CatPhotoApp</h2> <ide> <main> <ide> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <div class="silver-background"> <ide> <p>Things cats love:</p> <ide> <ul> <ide> tests: <ide> <li>other cats</li> <ide> </ol> <ide> </div> <del> <add> <ide> <form action="/submit-cat-photo"> <ide> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <ide> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/size-your-images.english.md <ide> Create a class called <code>smaller-image</code> and use it to resize the image <ide> ```yml <ide> tests: <ide> - text: Your <code>img</code> element should have the class <code>smaller-image</code>. <del> testString: 'assert($("img[src=''https://bit.ly/fcc-relaxing-cat'']").attr(''class'') === "smaller-image", ''Your <code>img</code> element should have the class <code>smaller-image</code>.'');' <add> testString: 'assert($("img[src="https://bit.ly/fcc-relaxing-cat"]").attr("class") === "smaller-image", "Your <code>img</code> element should have the class <code>smaller-image</code>.");' <ide> - text: Your image should be 100 pixels wide. Browser zoom should be at 100%. <del> testString: 'assert($("img").width() === 100, ''Your image should be 100 pixels wide. Browser zoom should be at 100%.'');' <add> testString: 'assert($("img").width() === 100, "Your image should be 100 pixels wide. Browser zoom should be at 100%.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2 class="red-text">CatPhotoApp</h2> <ide> <main> <ide> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <div> <ide> <p>Things cats love:</p> <ide> <ul> <ide> tests: <ide> <li>other cats</li> <ide> </ol> <ide> </div> <del> <add> <ide> <form action="/submit-cat-photo"> <ide> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <ide> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/specify-how-fonts-should-degrade.english.md <ide> In the last challenge, you imported the <code>Lobster</code> font using the <cod <ide> ```yml <ide> tests: <ide> - text: Your h2 element should use the font <code>Lobster</code>. <del> testString: 'assert($("h2").css("font-family").match(/^"?lobster/i), ''Your h2 element should use the font <code>Lobster</code>.'');' <add> testString: 'assert($("h2").css("font-family").match(/^"?lobster/i), "Your h2 element should use the font <code>Lobster</code>.");' <ide> - text: Your h2 element should degrade to the font <code>monospace</code> when <code>Lobster</code> is not available. <del> testString: 'assert(/\s*h2\s*\{\s*font-family\:\s*(\''|")?Lobster(\''|")?,\s*monospace\s*;\s*\}/gi.test(code), ''Your h2 element should degrade to the font <code>monospace</code> when <code>Lobster</code> is not available.'');' <add> testString: 'assert(/\s*h2\s*\{\s*font-family\:\s*(\"|")?Lobster(\"|")?,\s*monospace\s*;\s*\}/gi.test(code), "Your h2 element should degrade to the font <code>monospace</code> when <code>Lobster</code> is not available.");' <ide> - text: 'Comment out your call to Google for the <code>Lobster</code> font by putting <code>&#60!--</code> in front of it.' <del> testString: 'assert(new RegExp("<!--[^fc]", "gi").test(code), ''Comment out your call to Google for the <code>Lobster</code> font by putting <code>&#60!--</code> in front of it.'');' <add> testString: 'assert(new RegExp("<!--[^fc]", "gi").test(code), "Comment out your call to Google for the <code>Lobster</code> font by putting <code>&#60!--</code> in front of it.");' <ide> - text: 'Be sure to close your comment by adding <code>--&#62;</code>.' <del> testString: 'assert(new RegExp("[^fc]-->", "gi").test(code), ''Be sure to close your comment by adding <code>--&#62;</code>.'');' <add> testString: 'assert(new RegExp("[^fc]-->", "gi").test(code), "Be sure to close your comment by adding <code>--&#62;</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2 class="red-text">CatPhotoApp</h2> <ide> <main> <ide> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <div> <ide> <p>Things cats love:</p> <ide> <ul> <ide> tests: <ide> <li>other cats</li> <ide> </ol> <ide> </div> <del> <add> <ide> <form action="/submit-cat-photo"> <ide> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <ide> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/style-multiple-elements-with-a-css-class.english.md <ide> Classes allow you to use the same CSS styles on multiple HTML elements. You can <ide> ```yml <ide> tests: <ide> - text: Your <code>h2</code> element should be red. <del> testString: 'assert($("h2").css("color") === "rgb(255, 0, 0)", ''Your <code>h2</code> element should be red.'');' <add> testString: 'assert($("h2").css("color") === "rgb(255, 0, 0)", "Your <code>h2</code> element should be red.");' <ide> - text: Your <code>h2</code> element should have the class <code>red-text</code>. <del> testString: 'assert($("h2").hasClass("red-text"), ''Your <code>h2</code> element should have the class <code>red-text</code>.'');' <add> testString: 'assert($("h2").hasClass("red-text"), "Your <code>h2</code> element should have the class <code>red-text</code>.");' <ide> - text: Your first <code>p</code> element should be red. <del> testString: 'assert($("p:eq(0)").css("color") === "rgb(255, 0, 0)", ''Your first <code>p</code> element should be red.'');' <add> testString: 'assert($("p:eq(0)").css("color") === "rgb(255, 0, 0)", "Your first <code>p</code> element should be red.");' <ide> - text: Your second and third <code>p</code> elements should not be red. <del> testString: 'assert(!($("p:eq(1)").css("color") === "rgb(255, 0, 0)") && !($("p:eq(2)").css("color") === "rgb(255, 0, 0)"), ''Your second and third <code>p</code> elements should not be red.'');' <add> testString: 'assert(!($("p:eq(1)").css("color") === "rgb(255, 0, 0)") && !($("p:eq(2)").css("color") === "rgb(255, 0, 0)"), "Your second and third <code>p</code> elements should not be red.");' <ide> - text: Your first <code>p</code> element should have the class <code>red-text</code>. <del> testString: 'assert($("p:eq(0)").hasClass("red-text"), ''Your first <code>p</code> element should have the class <code>red-text</code>.'');' <add> testString: 'assert($("p:eq(0)").hasClass("red-text"), "Your first <code>p</code> element should have the class <code>red-text</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2 class="red-text">CatPhotoApp</h2> <ide> <main> <ide> <p>Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <div> <ide> <p>Things cats love:</p> <ide> <ul> <ide> tests: <ide> <li>other cats</li> <ide> </ol> <ide> </div> <del> <add> <ide> <form action="/submit-cat-photo"> <ide> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <ide> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/style-the-html-body-element.english.md <ide> We can do this by adding the following to our <code>style</code> element: <ide> ```yml <ide> tests: <ide> - text: Give your <code>body</code> element the <code>background-color</code> of black. <del> testString: 'assert($("body").css("background-color") === "rgb(0, 0, 0)", ''Give your <code>body</code> element the <code>background-color</code> of black.'');' <add> testString: 'assert($("body").css("background-color") === "rgb(0, 0, 0)", "Give your <code>body</code> element the <code>background-color</code> of black.");' <ide> - text: Make sure your CSS rule is properly formatted with both opening and closing curly brackets. <del> testString: 'assert(code.match(/<style>\s*body\s*\{\s*background.*\s*:\s*.*;\s*\}\s*<\/style>/i), ''Make sure your CSS rule is properly formatted with both opening and closing curly brackets.'');' <add> testString: 'assert(code.match(/<style>\s*body\s*\{\s*background.*\s*:\s*.*;\s*\}\s*<\/style>/i), "Make sure your CSS rule is properly formatted with both opening and closing curly brackets.");' <ide> - text: Make sure your CSS rule ends with a semi-colon. <del> testString: 'assert(code.match(/<style>\s*body\s*\{\s*background.*\s*:\s*.*;\s*\}\s*<\/style>/i), ''Make sure your CSS rule ends with a semi-colon.'');' <add> testString: 'assert(code.match(/<style>\s*body\s*\{\s*background.*\s*:\s*.*;\s*\}\s*<\/style>/i), "Make sure your CSS rule ends with a semi-colon.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/understand-absolute-versus-relative-units.english.md <ide> Add a <code>padding</code> property to the element with class <code>red-box</cod <ide> ```yml <ide> tests: <ide> - text: Your <code>red-box</code> class should have a <code>padding</code> property. <del> testString: 'assert($(''.red-box'').css(''padding-top'') != ''0px'' && $(''.red-box'').css(''padding-right'') != ''0px'' && $(''.red-box'').css(''padding-bottom'') != ''0px'' && $(''.red-box'').css(''padding-left'') != ''0px'', ''Your <code>red-box</code> class should have a <code>padding</code> property.'');' <add> testString: 'assert($(".red-box").css("padding-top") != "0px" && $(".red-box").css("padding-right") != "0px" && $(".red-box").css("padding-bottom") != "0px" && $(".red-box").css("padding-left") != "0px", "Your <code>red-box</code> class should have a <code>padding</code> property.");' <ide> - text: Your <code>red-box</code> class should give elements 1.5em of <code>padding</code>. <del> testString: 'assert(code.match(/\.red-box\s*?{\s*?.*?\s*?.*?\s*?padding:\s*?1\.5em/gi), ''Your <code>red-box</code> class should give elements 1.5em of <code>padding</code>.'');' <add> testString: 'assert(code.match(/\.red-box\s*?{\s*?.*?\s*?.*?\s*?padding:\s*?1\.5em/gi), "Your <code>red-box</code> class should give elements 1.5em of <code>padding</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> .red-box { <ide> background-color: red; <ide> margin: 20px 40px 20px 40px; <del> <add> <ide> } <ide> <ide> .green-box { <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-a-css-class-to-style-an-element.english.md <ide> Give your <code>h2</code> element the <code>class</code> attribute with a value <ide> ```yml <ide> tests: <ide> - text: Your <code>h2</code> element should be red. <del> testString: 'assert($("h2").css("color") === "rgb(255, 0, 0)", ''Your <code>h2</code> element should be red.'');' <add> testString: 'assert($("h2").css("color") === "rgb(255, 0, 0)", "Your <code>h2</code> element should be red.");' <ide> - text: Your <code>h2</code> element should have the class <code>red-text</code>. <del> testString: 'assert($("h2").hasClass("red-text"), ''Your <code>h2</code> element should have the class <code>red-text</code>.'');' <add> testString: 'assert($("h2").hasClass("red-text"), "Your <code>h2</code> element should have the class <code>red-text</code>.");' <ide> - text: Your stylesheet should declare a <code>red-text</code> class and have its color set to red. <del> testString: 'assert(code.match(/\.red-text\s*\{\s*color\s*:\s*red;\s*\}/g), ''Your stylesheet should declare a <code>red-text</code> class and have its color set to red.'');' <add> testString: 'assert(code.match(/\.red-text\s*\{\s*color\s*:\s*red;\s*\}/g), "Your stylesheet should declare a <code>red-text</code> class and have its color set to red.");' <ide> - text: 'Do not use inline style declarations like <code>style="color&#58; red"</code> in your <code>h2</code> element.' <del> testString: 'assert($("h2").attr("style") === undefined, ''Do not use inline style declarations like <code>style="color&#58; red"</code> in your <code>h2</code> element.'');' <add> testString: 'assert($("h2").attr("style") === undefined, "Do not use inline style declarations like <code>style="color&#58; red"</code> in your <code>h2</code> element.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2>CatPhotoApp</h2> <ide> <main> <ide> <p>Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <div> <ide> <p>Things cats love:</p> <ide> <ul> <ide> tests: <ide> <li>other cats</li> <ide> </ol> <ide> </div> <del> <add> <ide> <form action="/submit-cat-photo"> <ide> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <ide> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-a-custom-css-variable.english.md <ide> Apply the <code>--penguin-skin</code> variable to the <code>background</code> pr <ide> ```yml <ide> tests: <ide> - text: Apply the <code>--penguin-skin</code> variable to the <code>background</code> property of the <code>penguin-top</code> class. <del> testString: 'assert(code.match(/.penguin-top\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}[\s\S]*.penguin-bottom\s{/gi), ''Apply the <code>--penguin-skin</code> variable to the <code>background</code> property of the <code>penguin-top</code> class.'');' <add> testString: 'assert(code.match(/.penguin-top\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}[\s\S]*.penguin-bottom\s{/gi), "Apply the <code>--penguin-skin</code> variable to the <code>background</code> property of the <code>penguin-top</code> class.");' <ide> - text: Apply the <code>--penguin-skin</code> variable to the <code>background</code> property of the <code>penguin-bottom</code> class. <del> testString: 'assert(code.match(/.penguin-bottom\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}[\s\S]*.right-hand\s{/gi), ''Apply the <code>--penguin-skin</code> variable to the <code>background</code> property of the <code>penguin-bottom</code> class.'');' <add> testString: 'assert(code.match(/.penguin-bottom\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}[\s\S]*.right-hand\s{/gi), "Apply the <code>--penguin-skin</code> variable to the <code>background</code> property of the <code>penguin-bottom</code> class.");' <ide> - text: Apply the <code>--penguin-skin</code> variable to the <code>background</code> property of the <code>right-hand</code> class. <del> testString: 'assert(code.match(/.right-hand\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}[\s\S]*.left-hand\s{/gi), ''Apply the <code>--penguin-skin</code> variable to the <code>background</code> property of the <code>right-hand</code> class.'');' <add> testString: 'assert(code.match(/.right-hand\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}[\s\S]*.left-hand\s{/gi), "Apply the <code>--penguin-skin</code> variable to the <code>background</code> property of the <code>right-hand</code> class.");' <ide> - text: Apply the <code>--penguin-skin</code> variable to the <code>background</code> property of the <code>left-hand</code> class. <del> testString: 'assert(code.match(/.left-hand\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}/gi), ''Apply the <code>--penguin-skin</code> variable to the <code>background</code> property of the <code>left-hand</code> class.'');' <add> testString: 'assert(code.match(/.left-hand\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}/gi), "Apply the <code>--penguin-skin</code> variable to the <code>background</code> property of the <code>left-hand</code> class.");' <ide> <ide> ``` <ide> <ide> tests: <ide> width: 300px; <ide> height: 300px; <ide> } <del> <add> <ide> .penguin-top { <ide> top: 10%; <ide> left: 25%; <del> <add> <ide> /* change code below */ <ide> background: black; <ide> /* change code above */ <del> <add> <ide> width: 50%; <ide> height: 45%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .penguin-bottom { <ide> top: 40%; <ide> left: 23.5%; <del> <add> <ide> /* change code below */ <ide> background: black; <ide> /* change code above */ <del> <add> <ide> width: 53%; <ide> height: 45%; <ide> border-radius: 70% 70% 100% 100%; <ide> } <del> <add> <ide> .right-hand { <ide> top: 0%; <ide> left: -5%; <del> <add> <ide> /* change code below */ <ide> background: black; <ide> /* change code above */ <del> <add> <ide> width: 30%; <ide> height: 60%; <ide> border-radius: 30% 30% 120% 30%; <ide> transform: rotate(45deg); <ide> z-index: -1; <ide> } <del> <add> <ide> .left-hand { <ide> top: 0%; <ide> left: 75%; <del> <add> <ide> /* change code below */ <ide> background: black; <ide> /* change code above */ <del> <add> <ide> width: 30%; <ide> height: 60%; <ide> border-radius: 30% 30% 30% 120%; <ide> transform: rotate(-45deg); <ide> z-index: -1; <ide> } <del> <add> <ide> .right-cheek { <ide> top: 15%; <ide> left: 35%; <ide> tests: <ide> height: 70%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .left-cheek { <ide> top: 15%; <ide> left: 5%; <ide> tests: <ide> height: 70%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .belly { <ide> top: 60%; <ide> left: 2.5%; <ide> tests: <ide> height: 100%; <ide> border-radius: 120% 120% 100% 100%; <ide> } <del> <add> <ide> .right-feet { <ide> top: 85%; <ide> left: 60%; <ide> tests: <ide> height: 30%; <ide> border-radius: 50% 50% 50% 50%; <ide> transform: rotate(-80deg); <del> z-index: -2222; <add> z-index: -2222; <ide> } <del> <add> <ide> .left-feet { <ide> top: 85%; <ide> left: 25%; <ide> tests: <ide> height: 30%; <ide> border-radius: 50% 50% 50% 50%; <ide> transform: rotate(80deg); <del> z-index: -2222; <add> z-index: -2222; <ide> } <del> <add> <ide> .right-eye { <ide> top: 45%; <ide> left: 60%; <ide> background: black; <ide> width: 15%; <ide> height: 17%; <del> border-radius: 50%; <add> border-radius: 50%; <ide> } <del> <add> <ide> .left-eye { <ide> top: 45%; <ide> left: 25%; <ide> tests: <ide> height: 17%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .sparkle { <ide> top: 25%; <ide> left: 15%; <ide> tests: <ide> height: 35%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .blush-right { <ide> top: 65%; <ide> left: 15%; <ide> tests: <ide> height: 10%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .blush-left { <ide> top: 65%; <ide> left: 70%; <ide> tests: <ide> height: 10%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .beak-top { <ide> top: 60%; <ide> left: 40%; <ide> tests: <ide> height: 10%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .beak-bottom { <ide> top: 65%; <ide> left: 42%; <ide> tests: <ide> height: 10%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> body { <ide> background:#c6faf1; <ide> } <del> <add> <ide> .penguin * { <ide> position: absolute; <ide> } <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-a-media-query-to-change-a-variable.english.md <ide> In the <code>:root</code> selector of the <code>media query</code>, change it so <ide> ```yml <ide> tests: <ide> - text: '<code>:root</code> should reassign the <code>--penguin-size</code> variable to <code>200px</code>.' <del> testString: 'assert(code.match(/media\s*?\(\s*?max-width\s*?:\s*?350px\s*?\)\s*?{[\s\S]*:root\s*?{[\s\S]*--penguin-size\s*?:\s*?200px\s*?;[\s\S]*}[\s\S]*}/gi), ''<code>:root</code> should reassign the <code>--penguin-size</code> variable to <code>200px</code>.'');' <add> testString: 'assert(code.match(/media\s*?\(\s*?max-width\s*?:\s*?350px\s*?\)\s*?{[\s\S]*:root\s*?{[\s\S]*--penguin-size\s*?:\s*?200px\s*?;[\s\S]*}[\s\S]*}/gi), "<code>:root</code> should reassign the <code>--penguin-size</code> variable to <code>200px</code>.");' <ide> - text: '<code>:root</code> should reassign the <code>--penguin-skin</code> variable to <code>black</code>.' <del> testString: 'assert(code.match(/media\s*?\(\s*?max-width\s*?:\s*?350px\s*?\)\s*?{[\s\S]*:root\s*?{[\s\S]*--penguin-skin\s*?:\s*?black\s*?;[\s\S]*}[\s\S]*}/gi), ''<code>:root</code> should reassign the <code>--penguin-skin</code> variable to <code>black</code>.'');' <add> testString: 'assert(code.match(/media\s*?\(\s*?max-width\s*?:\s*?350px\s*?\)\s*?{[\s\S]*:root\s*?{[\s\S]*--penguin-skin\s*?:\s*?black\s*?;[\s\S]*}[\s\S]*}/gi), "<code>:root</code> should reassign the <code>--penguin-skin</code> variable to <code>black</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> --penguin-belly: white; <ide> --penguin-beak: orange; <ide> } <del> <add> <ide> @media (max-width: 350px) { <ide> :root { <del> <add> <ide> /* add code below */ <del> <add> <ide> /* add code above */ <del> <add> <ide> } <ide> } <del> <add> <ide> .penguin { <ide> position: relative; <ide> margin: auto; <ide> tests: <ide> width: var(--penguin-size, 300px); <ide> height: var(--penguin-size, 300px); <ide> } <del> <add> <ide> .right-cheek { <ide> top: 15%; <ide> left: 35%; <ide> tests: <ide> height: 70%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .left-cheek { <ide> top: 15%; <ide> left: 5%; <ide> tests: <ide> height: 70%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .belly { <ide> top: 60%; <ide> left: 2.5%; <ide> tests: <ide> height: 100%; <ide> border-radius: 120% 120% 100% 100%; <ide> } <del> <add> <ide> .penguin-top { <ide> top: 10%; <ide> left: 25%; <ide> tests: <ide> height: 45%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .penguin-bottom { <ide> top: 40%; <ide> left: 23.5%; <ide> tests: <ide> height: 45%; <ide> border-radius: 70% 70% 100% 100%; <ide> } <del> <add> <ide> .right-hand { <ide> top: 5%; <ide> left: 25%; <ide> tests: <ide> transform-origin:0% 0%; <ide> animation-timing-function: linear; <ide> } <del> <add> <ide> @keyframes wave { <ide> 10% { <ide> transform: rotate(110deg); <ide> tests: <ide> } <ide> 30% { <ide> transform: rotate(110deg); <del> } <add> } <ide> 40% { <ide> transform: rotate(130deg); <del> } <add> } <ide> } <del> <add> <ide> .left-hand { <ide> top: 0%; <ide> left: 75%; <ide> tests: <ide> transform: rotate(-45deg); <ide> z-index: -1; <ide> } <del> <add> <ide> .right-feet { <ide> top: 85%; <ide> left: 60%; <ide> tests: <ide> transform: rotate(-80deg); <ide> z-index: -2222; <ide> } <del> <add> <ide> .left-feet { <ide> top: 85%; <ide> left: 25%; <ide> tests: <ide> transform: rotate(80deg); <ide> z-index: -2222; <ide> } <del> <add> <ide> .right-eye { <ide> top: 45%; <ide> left: 60%; <ide> tests: <ide> height: 17%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .left-eye { <ide> top: 45%; <ide> left: 25%; <ide> tests: <ide> height: 17%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .sparkle { <ide> top: 25%; <ide> left:-23%; <ide> tests: <ide> height: 100%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .blush-right { <ide> top: 65%; <ide> left: 15%; <ide> tests: <ide> height: 10%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .blush-left { <ide> top: 65%; <ide> left: 70%; <ide> tests: <ide> height: 10%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .beak-top { <ide> top: 60%; <ide> left: 40%; <ide> tests: <ide> height: 10%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> .beak-bottom { <ide> top: 65%; <ide> left: 42%; <ide> tests: <ide> height: 10%; <ide> border-radius: 50%; <ide> } <del> <add> <ide> body { <ide> background:#c6faf1; <ide> } <del> <add> <ide> .penguin * { <ide> position: absolute; <ide> } <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-abbreviated-hex-code.english.md <ide> Go ahead, try using the abbreviated hex codes to color the correct elements. <ide> ```yml <ide> tests: <ide> - text: Give your <code>h1</code> element with the text <code>I am red!</code> the <code>color</code> red. <del> testString: 'assert($(''.red-text'').css(''color'') === ''rgb(255, 0, 0)'', ''Give your <code>h1</code> element with the text <code>I am red!</code> the <code>color</code> red.'');' <add> testString: 'assert($(".red-text").css("color") === "rgb(255, 0, 0)", "Give your <code>h1</code> element with the text <code>I am red!</code> the <code>color</code> red.");' <ide> - text: 'Use the abbreviate <code>hex code</code> for the color red instead of the hex code <code>#FF0000</code>.' <del> testString: 'assert(code.match(/\.red-text\s*?{\s*?color:\s*?#F00\s*?;\s*?}/gi), ''Use the abbreviate <code>hex code</code> for the color red instead of the hex code <code>#FF0000</code>.'');' <add> testString: 'assert(code.match(/\.red-text\s*?{\s*?color:\s*?#F00\s*?;\s*?}/gi), "Use the abbreviate <code>hex code</code> for the color red instead of the hex code <code>#FF0000</code>.");' <ide> - text: Give your <code>h1</code> element with the text <code>I am green!</code> the <code>color</code> green. <del> testString: 'assert($(''.green-text'').css(''color'') === ''rgb(0, 255, 0)'', ''Give your <code>h1</code> element with the text <code>I am green!</code> the <code>color</code> green.'');' <add> testString: 'assert($(".green-text").css("color") === "rgb(0, 255, 0)", "Give your <code>h1</code> element with the text <code>I am green!</code> the <code>color</code> green.");' <ide> - text: 'Use the abbreviated <code>hex code</code> for the color green instead of the hex code <code>#00FF00</code>.' <del> testString: 'assert(code.match(/\.green-text\s*?{\s*?color:\s*?#0F0\s*?;\s*?}/gi), ''Use the abbreviated <code>hex code</code> for the color green instead of the hex code <code>#00FF00</code>.'');' <add> testString: 'assert(code.match(/\.green-text\s*?{\s*?color:\s*?#0F0\s*?;\s*?}/gi), "Use the abbreviated <code>hex code</code> for the color green instead of the hex code <code>#00FF00</code>.");' <ide> - text: Give your <code>h1</code> element with the text <code>I am cyan!</code> the <code>color</code> cyan. <del> testString: 'assert($(''.cyan-text'').css(''color'') === ''rgb(0, 255, 255)'', ''Give your <code>h1</code> element with the text <code>I am cyan!</code> the <code>color</code> cyan.'');' <add> testString: 'assert($(".cyan-text").css("color") === "rgb(0, 255, 255)", "Give your <code>h1</code> element with the text <code>I am cyan!</code> the <code>color</code> cyan.");' <ide> - text: 'Use the abbreviated <code>hex code</code> for the color cyan instead of the hex code <code>#00FFFF</code>.' <del> testString: 'assert(code.match(/\.cyan-text\s*?{\s*?color:\s*?#0FF\s*?;\s*?}/gi), ''Use the abbreviated <code>hex code</code> for the color cyan instead of the hex code <code>#00FFFF</code>.'');' <add> testString: 'assert(code.match(/\.cyan-text\s*?{\s*?color:\s*?#0FF\s*?;\s*?}/gi), "Use the abbreviated <code>hex code</code> for the color cyan instead of the hex code <code>#00FFFF</code>.");' <ide> - text: Give your <code>h1</code> element with the text <code>I am fuchsia!</code> the <code>color</code> fuchsia. <del> testString: 'assert($(''.fuchsia-text'').css(''color'') === ''rgb(255, 0, 255)'', ''Give your <code>h1</code> element with the text <code>I am fuchsia!</code> the <code>color</code> fuchsia.'');' <add> testString: 'assert($(".fuchsia-text").css("color") === "rgb(255, 0, 255)", "Give your <code>h1</code> element with the text <code>I am fuchsia!</code> the <code>color</code> fuchsia.");' <ide> - text: 'Use the abbreviated <code>hex code</code> for the color fuchsia instead of the hex code <code>#FF00FF</code>.' <del> testString: 'assert(code.match(/\.fuchsia-text\s*?{\s*?color:\s*?#F0F\s*?;\s*?}/gi), ''Use the abbreviated <code>hex code</code> for the color fuchsia instead of the hex code <code>#FF00FF</code>.'');' <add> testString: 'assert(code.match(/\.fuchsia-text\s*?{\s*?color:\s*?#F0F\s*?;\s*?}/gi), "Use the abbreviated <code>hex code</code> for the color fuchsia instead of the hex code <code>#FF00FF</code>.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-an-id-attribute-to-style-an-element.english.md <ide> Try giving your form, which now has the <code>id</code> attribute of <code>cat-p <ide> ```yml <ide> tests: <ide> - text: Give your <code>form</code> element the id of <code>cat-photo-form</code>. <del> testString: 'assert($("form").attr("id") === "cat-photo-form", ''Give your <code>form</code> element the id of <code>cat-photo-form</code>.'');' <add> testString: 'assert($("form").attr("id") === "cat-photo-form", "Give your <code>form</code> element the id of <code>cat-photo-form</code>.");' <ide> - text: Your <code>form</code> element should have the <code>background-color</code> of green. <del> testString: 'assert($("#cat-photo-form").css("background-color") === "rgb(0, 128, 0)", ''Your <code>form</code> element should have the <code>background-color</code> of green.'');' <add> testString: 'assert($("#cat-photo-form").css("background-color") === "rgb(0, 128, 0)", "Your <code>form</code> element should have the <code>background-color</code> of green.");' <ide> - text: Make sure your <code>form</code> element has an <code>id</code> attribute. <del> testString: 'assert(code.match(/<form.*cat-photo-form.*>/gi) && code.match(/<form.*cat-photo-form.*>/gi).length > 0, ''Make sure your <code>form</code> element has an <code>id</code> attribute.'');' <add> testString: 'assert(code.match(/<form.*cat-photo-form.*>/gi) && code.match(/<form.*cat-photo-form.*>/gi).length > 0, "Make sure your <code>form</code> element has an <code>id</code> attribute.");' <ide> - text: Do not give your <code>form</code> any <code>class</code> or <code>style</code> attributes. <del> testString: 'assert(!code.match(/<form.*style.*>/gi) && !code.match(/<form.*class.*>/gi), ''Do not give your <code>form</code> any <code>class</code> or <code>style</code> attributes.'');' <add> testString: 'assert(!code.match(/<form.*style.*>/gi) && !code.match(/<form.*class.*>/gi), "Do not give your <code>form</code> any <code>class</code> or <code>style</code> attributes.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2 class="red-text">CatPhotoApp</h2> <ide> <main> <ide> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <div class="silver-background"> <ide> <p>Things cats love:</p> <ide> <ul> <ide> tests: <ide> <li>other cats</li> <ide> </ol> <ide> </div> <del> <add> <ide> <form action="/submit-cat-photo" id="cat-photo-form"> <ide> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <ide> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-attribute-selectors-to-style-elements.english.md <ide> Using the <code>type</code> attribute selector, try to give the checkboxes in Ca <ide> ```yml <ide> tests: <ide> - text: The <code>type</code> attribute selector should be used to select the checkboxes. <del> testString: 'assert(code.match(/<style>[\s\S]*?\[type=("|'')checkbox\1\]\s*?{[\s\S]*?}[\s\S]*?<\/style>/gi),''The <code>type</code> attribute selector should be used to select the checkboxes.'');' <add> testString: 'assert(code.match(/<style>[\s\S]*?\[type=("|")checkbox\1\]\s*?{[\s\S]*?}[\s\S]*?<\/style>/gi),"The <code>type</code> attribute selector should be used to select the checkboxes.");' <ide> - text: The top margins of the checkboxes should be 10px. <del> testString: 'assert((function() {var count=0; $("[type=''checkbox'']").each(function() { if($(this).css(''marginTop'') === ''10px'') {count++;}});return (count===3)}()),''The top margins of the checkboxes should be 10px.'');' <add> testString: 'assert((function() {var count=0; $("[type="checkbox"]").each(function() { if($(this).css("marginTop") === "10px") {count++;}});return (count===3)}()),"The top margins of the checkboxes should be 10px.");' <ide> - text: The bottom margins of the checkboxes should be 15px. <del> testString: 'assert((function() {var count=0; $("[type=''checkbox'']").each(function() { if($(this).css(''marginBottom'') === ''15px'') {count++;}});return (count===3)}()),''The bottom margins of the checkboxes should be 15px.'');' <add> testString: 'assert((function() {var count=0; $("[type="checkbox"]").each(function() { if($(this).css("marginBottom") === "15px") {count++;}});return (count===3)}()),"The bottom margins of the checkboxes should be 15px.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2 class="red-text">CatPhotoApp</h2> <ide> <main> <ide> <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <div class="silver-background"> <ide> <p>Things cats love:</p> <ide> <ul> <ide> tests: <ide> <li>other cats</li> <ide> </ol> <ide> </div> <del> <add> <ide> <form action="/submit-cat-photo" id="cat-photo-form"> <ide> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <ide> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-clockwise-notation-to-specify-the-margin-of-an-element.english.md <ide> Use <code>Clockwise Notation</code> to give the element with the <code>blue-box< <ide> ```yml <ide> tests: <ide> - text: Your <code>blue-box</code> class should give the top of elements <code>40px</code> of <code>margin</code>. <del> testString: 'assert($(".blue-box").css("margin-top") === "40px", ''Your <code>blue-box</code> class should give the top of elements <code>40px</code> of <code>margin</code>.'');' <add> testString: 'assert($(".blue-box").css("margin-top") === "40px", "Your <code>blue-box</code> class should give the top of elements <code>40px</code> of <code>margin</code>.");' <ide> - text: Your <code>blue-box</code> class should give the right of elements <code>20px</code> of <code>margin</code>. <del> testString: 'assert($(".blue-box").css("margin-right") === "20px", ''Your <code>blue-box</code> class should give the right of elements <code>20px</code> of <code>margin</code>.'');' <add> testString: 'assert($(".blue-box").css("margin-right") === "20px", "Your <code>blue-box</code> class should give the right of elements <code>20px</code> of <code>margin</code>.");' <ide> - text: Your <code>blue-box</code> class should give the bottom of elements <code>20px</code> of <code>margin</code>. <del> testString: 'assert($(".blue-box").css("margin-bottom") === "20px", ''Your <code>blue-box</code> class should give the bottom of elements <code>20px</code> of <code>margin</code>.'');' <add> testString: 'assert($(".blue-box").css("margin-bottom") === "20px", "Your <code>blue-box</code> class should give the bottom of elements <code>20px</code> of <code>margin</code>.");' <ide> - text: Your <code>blue-box</code> class should give the left of elements <code>40px</code> of <code>margin</code>. <del> testString: 'assert($(".blue-box").css("margin-left") === "40px", ''Your <code>blue-box</code> class should give the left of elements <code>40px</code> of <code>margin</code>.'');' <add> testString: 'assert($(".blue-box").css("margin-left") === "40px", "Your <code>blue-box</code> class should give the left of elements <code>40px</code> of <code>margin</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> background-color: yellow; <ide> padding: 20px 40px 20px 40px; <ide> } <del> <add> <ide> .red-box { <ide> background-color: crimson; <ide> color: #fff; <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-clockwise-notation-to-specify-the-padding-of-an-element.english.md <ide> Use Clockwise Notation to give the ".blue-box" class a <code>padding</code> of < <ide> ```yml <ide> tests: <ide> - text: Your <code>blue-box</code> class should give the top of elements <code>40px</code> of <code>padding</code>. <del> testString: 'assert($(".blue-box").css("padding-top") === "40px", ''Your <code>blue-box</code> class should give the top of elements <code>40px</code> of <code>padding</code>.'');' <add> testString: 'assert($(".blue-box").css("padding-top") === "40px", "Your <code>blue-box</code> class should give the top of elements <code>40px</code> of <code>padding</code>.");' <ide> - text: Your <code>blue-box</code> class should give the right of elements <code>20px</code> of <code>padding</code>. <del> testString: 'assert($(".blue-box").css("padding-right") === "20px", ''Your <code>blue-box</code> class should give the right of elements <code>20px</code> of <code>padding</code>.'');' <add> testString: 'assert($(".blue-box").css("padding-right") === "20px", "Your <code>blue-box</code> class should give the right of elements <code>20px</code> of <code>padding</code>.");' <ide> - text: Your <code>blue-box</code> class should give the bottom of elements <code>20px</code> of <code>padding</code>. <del> testString: 'assert($(".blue-box").css("padding-bottom") === "20px", ''Your <code>blue-box</code> class should give the bottom of elements <code>20px</code> of <code>padding</code>.'');' <add> testString: 'assert($(".blue-box").css("padding-bottom") === "20px", "Your <code>blue-box</code> class should give the bottom of elements <code>20px</code> of <code>padding</code>.");' <ide> - text: Your <code>blue-box</code> class should give the left of elements <code>40px</code> of <code>padding</code>. <del> testString: 'assert($(".blue-box").css("padding-left") === "40px", ''Your <code>blue-box</code> class should give the left of elements <code>40px</code> of <code>padding</code>.'');' <add> testString: 'assert($(".blue-box").css("padding-left") === "40px", "Your <code>blue-box</code> class should give the left of elements <code>40px</code> of <code>padding</code>.");' <ide> - text: You should use the clockwise notation to set the padding of <code>blue-box</code> class. <del> testString: 'assert(!/padding-top|padding-right|padding-bottom|padding-left/.test(code), ''You should use the clockwise notation to set the padding of <code>blue-box</code> class.'');' <add> testString: 'assert(!/padding-top|padding-right|padding-bottom|padding-left/.test(code), "You should use the clockwise notation to set the padding of <code>blue-box</code> class.");' <ide> <ide> ``` <ide> <ide> tests: <ide> background-color: yellow; <ide> padding: 20px 40px 20px 40px; <ide> } <del> <add> <ide> .red-box { <ide> background-color: crimson; <ide> color: #fff; <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-css-selectors-to-style-elements.english.md <ide> Delete your <code>h2</code> element's style attribute, and instead create a CSS <ide> ```yml <ide> tests: <ide> - text: Remove the style attribute from your <code>h2</code> element. <del> testString: 'assert(!$("h2").attr("style"), ''Remove the style attribute from your <code>h2</code> element.'');' <add> testString: 'assert(!$("h2").attr("style"), "Remove the style attribute from your <code>h2</code> element.");' <ide> - text: Create a <code>style</code> element. <del> testString: 'assert($("style") && $("style").length > 1, ''Create a <code>style</code> element.'');' <add> testString: 'assert($("style") && $("style").length > 1, "Create a <code>style</code> element.");' <ide> - text: Your <code>h2</code> element should be blue. <del> testString: 'assert($("h2").css("color") === "rgb(0, 0, 255)", ''Your <code>h2</code> element should be blue.'');' <add> testString: 'assert($("h2").css("color") === "rgb(0, 0, 255)", "Your <code>h2</code> element should be blue.");' <ide> - text: Ensure that your stylesheet <code>h2</code> declaration is valid with a semicolon and closing brace. <del> testString: 'assert(code.match(/h2\s*\{\s*color\s*:.*;\s*\}/g), ''Ensure that your stylesheet <code>h2</code> declaration is valid with a semicolon and closing brace.'');' <add> testString: 'assert(code.match(/h2\s*\{\s*color\s*:.*;\s*\}/g), "Ensure that your stylesheet <code>h2</code> declaration is valid with a semicolon and closing brace.");' <ide> - text: Make sure all your <code>style</code> elements are valid and have a closing tag. <del> testString: 'assert(code.match(/<\/style>/g) && code.match(/<\/style>/g).length === (code.match(/<style((\s)*((type|media|scoped|title|disabled)="[^"]*")?(\s)*)*>/g) || []).length, ''Make sure all your <code>style</code> elements are valid and have a closing tag.'');' <add> testString: 'assert(code.match(/<\/style>/g) && code.match(/<\/style>/g).length === (code.match(/<style((\s)*((type|media|scoped|title|disabled)="[^"]*")?(\s)*)*>/g) || []).length, "Make sure all your <code>style</code> elements are valid and have a closing tag.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2 style="color: red">CatPhotoApp</h2> <ide> <main> <ide> <p>Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <div> <ide> <p>Things cats love:</p> <ide> <ul> <ide> tests: <ide> <li>other cats</li> <ide> </ol> <ide> </div> <del> <add> <ide> <form action="/submit-cat-photo"> <ide> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <ide> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-css-variables-to-change-several-elements-at-once.english.md <ide> In the <code>penguin</code> class, change the <code>black</code> value to <code> <ide> ```yml <ide> tests: <ide> - text: <code>penguin</code> class should declare the <code>--penguin-skin</code> variable and assign it to <code>gray</code>. <del> testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-skin\s*?:\s*?gray\s*?;[\s\S]*}/gi), ''<code>penguin</code> class should declare the <code>--penguin-skin</code> variable and assign it to <code>gray</code>.'');' <add> testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-skin\s*?:\s*?gray\s*?;[\s\S]*}/gi), "<code>penguin</code> class should declare the <code>--penguin-skin</code> variable and assign it to <code>gray</code>.");' <ide> - text: <code>penguin</code> class should declare the <code>--penguin-belly</code> variable and assign it to <code>white</code>. <del> testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-belly\s*?:\s*?white\s*?;[\s\S]*}/gi), ''<code>penguin</code> class should declare the <code>--penguin-belly</code> variable and assign it to <code>white</code>.'');' <add> testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-belly\s*?:\s*?white\s*?;[\s\S]*}/gi), "<code>penguin</code> class should declare the <code>--penguin-belly</code> variable and assign it to <code>white</code>.");' <ide> - text: <code>penguin</code> class should declare the <code>--penguin-beak</code> variable and assign it to <code>orange</code>. <del> testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-beak\s*?:\s*?orange\s*?;[\s\S]*}/gi), ''<code>penguin</code> class should declare the <code>--penguin-beak</code> variable and assign it to <code>orange</code>.'');' <add> testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-beak\s*?:\s*?orange\s*?;[\s\S]*}/gi), "<code>penguin</code> class should declare the <code>--penguin-beak</code> variable and assign it to <code>orange</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```html <ide> <style> <ide> .penguin { <del> <add> <ide> /* change code below */ <ide> --penguin-skin: black; <ide> --penguin-belly: gray; <ide> --penguin-beak: yellow; <ide> /* change code above */ <del> <add> <ide> position: relative; <ide> margin: auto; <ide> display: block; <ide> margin-top: 5%; <ide> width: 300px; <ide> height: 300px; <ide> } <del> <add> <ide> .penguin-top { <ide> top: 10%; <ide> left: 25%; <ide> tests: <ide> height: 45%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .penguin-bottom { <ide> top: 40%; <ide> left: 23.5%; <ide> tests: <ide> height: 45%; <ide> border-radius: 70% 70% 100% 100%; <ide> } <del> <add> <ide> .right-hand { <ide> top: 0%; <ide> left: -5%; <ide> tests: <ide> transform: rotate(45deg); <ide> z-index: -1; <ide> } <del> <add> <ide> .left-hand { <ide> top: 0%; <ide> left: 75%; <ide> tests: <ide> transform: rotate(-45deg); <ide> z-index: -1; <ide> } <del> <add> <ide> .right-cheek { <ide> top: 15%; <ide> left: 35%; <ide> tests: <ide> height: 70%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .left-cheek { <ide> top: 15%; <ide> left: 5%; <ide> tests: <ide> height: 70%; <ide> border-radius: 70% 70% 60% 60%; <ide> } <del> <add> <ide> .belly { <ide> top: 60%; <ide> left: 2.5%; <ide> tests: <ide> height: 100%; <ide> border-radius: 120% 120% 100% 100%; <ide> } <del> <add> <ide> .right-feet { <ide> top: 85%; <ide> left: 60%; <ide> tests: <ide> height: 30%; <ide> border-radius: 50% 50% 50% 50%; <ide> transform: rotate(-80deg); <del> z-index: -2222; <add> z-index: -2222; <ide> } <del> <add> <ide> .left-feet { <ide> top: 85%; <ide> left: 25%; <ide> tests: <ide> height: 30%; <ide> border-radius: 50% 50% 50% 50%; <ide> transform: rotate(80deg); <del> z-index: -2222; <add> z-index: -2222; <ide> } <del> <add> <ide> .right-eye { <ide> top: 45%; <ide> left: 60%; <ide> background: black; <ide> width: 15%; <ide> height: 17%; <del> border-radius: 50%; <add> border-radius: 50%; <ide> } <del> <add> <ide> .left-eye { <ide> top: 45%; <ide> left: 25%; <ide> background: black; <ide> width: 15%; <ide> height: 17%; <del> border-radius: 50%; <add> border-radius: 50%; <ide> } <del> <add> <ide> .sparkle { <ide> top: 25%; <ide> left: 15%; <ide> background: white; <ide> width: 35%; <ide> height: 35%; <del> border-radius: 50%; <add> border-radius: 50%; <ide> } <del> <add> <ide> .blush-right { <ide> top: 65%; <ide> left: 15%; <ide> background: pink; <ide> width: 15%; <ide> height: 10%; <del> border-radius: 50%; <add> border-radius: 50%; <ide> } <del> <add> <ide> .blush-left { <ide> top: 65%; <ide> left: 70%; <ide> background: pink; <ide> width: 15%; <ide> height: 10%; <del> border-radius: 50%; <add> border-radius: 50%; <ide> } <del> <add> <ide> .beak-top { <ide> top: 60%; <ide> left: 40%; <ide> background: var(--penguin-beak, orange); <ide> width: 20%; <ide> height: 10%; <del> border-radius: 50%; <add> border-radius: 50%; <ide> } <del> <add> <ide> .beak-bottom { <ide> top: 65%; <ide> left: 42%; <ide> background: var(--penguin-beak, orange); <ide> width: 16%; <ide> height: 10%; <del> border-radius: 50%; <add> border-radius: 50%; <ide> } <del> <add> <ide> body { <ide> background:#c6faf1; <ide> } <del> <add> <ide> .penguin * { <ide> position: absolute; <ide> } <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-hex-code-for-specific-colors.english.md <ide> Replace the word <code>black</code> in our <code>body</code> element's backgroun <ide> ```yml <ide> tests: <ide> - text: Give your <code>body</code> element the background-color of black. <del> testString: 'assert($("body").css("background-color") === "rgb(0, 0, 0)", ''Give your <code>body</code> element the background-color of black.'');' <add> testString: 'assert($("body").css("background-color") === "rgb(0, 0, 0)", "Give your <code>body</code> element the background-color of black.");' <ide> - text: Use the <code>hex code</code> for the color black instead of the word <code>black</code>. <del> testString: 'assert(code.match(/body\s*{(([\s\S]*;\s*?)|\s*?)background.*\s*:\s*?#000(000)?((\s*})|(;[\s\S]*?}))/gi), ''Use the <code>hex code</code> for the color black instead of the word <code>black</code>.'');' <add> testString: 'assert(code.match(/body\s*{(([\s\S]*;\s*?)|\s*?)background.*\s*:\s*?#000(000)?((\s*})|(;[\s\S]*?}))/gi), "Use the <code>hex code</code> for the color black instead of the word <code>black</code>.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-hex-code-to-mix-colors.english.md <ide> Replace the color words in our <code>style</code> element with their correct hex <ide> ```yml <ide> tests: <ide> - text: Give your <code>h1</code> element with the text <code>I am red!</code> the <code>color</code> red. <del> testString: 'assert($(''.red-text'').css(''color'') === ''rgb(255, 0, 0)'', ''Give your <code>h1</code> element with the text <code>I am red!</code> the <code>color</code> red.'');' <add> testString: 'assert($(".red-text").css("color") === "rgb(255, 0, 0)", "Give your <code>h1</code> element with the text <code>I am red!</code> the <code>color</code> red.");' <ide> - text: Use the <code>hex code</code> for the color red instead of the word <code>red</code>. <del> testString: 'assert(code.match(/\.red-text\s*?{\s*?color:\s*?#FF0000\s*?;\s*?}/gi), ''Use the <code>hex code</code> for the color red instead of the word <code>red</code>.'');' <add> testString: 'assert(code.match(/\.red-text\s*?{\s*?color:\s*?#FF0000\s*?;\s*?}/gi), "Use the <code>hex code</code> for the color red instead of the word <code>red</code>.");' <ide> - text: Give your <code>h1</code> element with the text <code>I am green!</code> the <code>color</code> green. <del> testString: 'assert($(''.green-text'').css(''color'') === ''rgb(0, 255, 0)'', ''Give your <code>h1</code> element with the text <code>I am green!</code> the <code>color</code> green.'');' <add> testString: 'assert($(".green-text").css("color") === "rgb(0, 255, 0)", "Give your <code>h1</code> element with the text <code>I am green!</code> the <code>color</code> green.");' <ide> - text: Use the <code>hex code</code> for the color green instead of the word <code>green</code>. <del> testString: 'assert(code.match(/\.green-text\s*?{\s*?color:\s*?#00FF00\s*?;\s*?}/gi), ''Use the <code>hex code</code> for the color green instead of the word <code>green</code>.'');' <add> testString: 'assert(code.match(/\.green-text\s*?{\s*?color:\s*?#00FF00\s*?;\s*?}/gi), "Use the <code>hex code</code> for the color green instead of the word <code>green</code>.");' <ide> - text: Give your <code>h1</code> element with the text <code>I am dodger blue!</code> the <code>color</code> dodger blue. <del> testString: 'assert($(''.dodger-blue-text'').css(''color'') === ''rgb(30, 144, 255)'', ''Give your <code>h1</code> element with the text <code>I am dodger blue!</code> the <code>color</code> dodger blue.'');' <add> testString: 'assert($(".dodger-blue-text").css("color") === "rgb(30, 144, 255)", "Give your <code>h1</code> element with the text <code>I am dodger blue!</code> the <code>color</code> dodger blue.");' <ide> - text: Use the <code>hex code</code> for the color dodger blue instead of the word <code>dodgerblue</code>. <del> testString: 'assert(code.match(/\.dodger-blue-text\s*?{\s*?color:\s*?#1E90FF\s*?;\s*?}/gi), ''Use the <code>hex code</code> for the color dodger blue instead of the word <code>dodgerblue</code>.'');' <add> testString: 'assert(code.match(/\.dodger-blue-text\s*?{\s*?color:\s*?#1E90FF\s*?;\s*?}/gi), "Use the <code>hex code</code> for the color dodger blue instead of the word <code>dodgerblue</code>.");' <ide> - text: Give your <code>h1</code> element with the text <code>I am orange!</code> the <code>color</code> orange. <del> testString: 'assert($(''.orange-text'').css(''color'') === ''rgb(255, 165, 0)'', ''Give your <code>h1</code> element with the text <code>I am orange!</code> the <code>color</code> orange.'');' <add> testString: 'assert($(".orange-text").css("color") === "rgb(255, 165, 0)", "Give your <code>h1</code> element with the text <code>I am orange!</code> the <code>color</code> orange.");' <ide> - text: Use the <code>hex code</code> for the color orange instead of the word <code>orange</code>. <del> testString: 'assert(code.match(/\.orange-text\s*?{\s*?color:\s*?#FFA500\s*?;\s*?}/gi), ''Use the <code>hex code</code> for the color orange instead of the word <code>orange</code>.'');' <add> testString: 'assert(code.match(/\.orange-text\s*?{\s*?color:\s*?#FFA500\s*?;\s*?}/gi), "Use the <code>hex code</code> for the color orange instead of the word <code>orange</code>.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-rgb-to-mix-colors.english.md <ide> Replace the hex codes in our <code>style</code> element with their correct RGB v <ide> ```yml <ide> tests: <ide> - text: Give your <code>h1</code> element with the text <code>I am red!</code> the <code>color</code> red. <del> testString: 'assert($(''.red-text'').css(''color'') === ''rgb(255, 0, 0)'', ''Give your <code>h1</code> element with the text <code>I am red!</code> the <code>color</code> red.'');' <add> testString: 'assert($(".red-text").css("color") === "rgb(255, 0, 0)", "Give your <code>h1</code> element with the text <code>I am red!</code> the <code>color</code> red.");' <ide> - text: Use <code>rgb</code> for the color red. <del> testString: 'assert(code.match(/\.red-text\s*?{\s*?color:\s*?rgb\(\s*?255\s*?,\s*?0\s*?,\s*?0\s*?\)\s*?;\s*?}/gi), ''Use <code>rgb</code> for the color red.'');' <add> testString: 'assert(code.match(/\.red-text\s*?{\s*?color:\s*?rgb\(\s*?255\s*?,\s*?0\s*?,\s*?0\s*?\)\s*?;\s*?}/gi), "Use <code>rgb</code> for the color red.");' <ide> - text: Give your <code>h1</code> element with the text <code>I am orchid!</code> the <code>color</code> orchid. <del> testString: 'assert($(''.orchid-text'').css(''color'') === ''rgb(218, 112, 214)'', ''Give your <code>h1</code> element with the text <code>I am orchid!</code> the <code>color</code> orchid.'');' <add> testString: 'assert($(".orchid-text").css("color") === "rgb(218, 112, 214)", "Give your <code>h1</code> element with the text <code>I am orchid!</code> the <code>color</code> orchid.");' <ide> - text: Use <code>rgb</code> for the color orchid. <del> testString: 'assert(code.match(/\.orchid-text\s*?{\s*?color:\s*?rgb\(\s*?218\s*?,\s*?112\s*?,\s*?214\s*?\)\s*?;\s*?}/gi), ''Use <code>rgb</code> for the color orchid.'');' <add> testString: 'assert(code.match(/\.orchid-text\s*?{\s*?color:\s*?rgb\(\s*?218\s*?,\s*?112\s*?,\s*?214\s*?\)\s*?;\s*?}/gi), "Use <code>rgb</code> for the color orchid.");' <ide> - text: Give your <code>h1</code> element with the text <code>I am blue!</code> the <code>color</code> blue. <del> testString: 'assert($(''.blue-text'').css(''color'') === ''rgb(0, 0, 255)'', ''Give your <code>h1</code> element with the text <code>I am blue!</code> the <code>color</code> blue.'');' <add> testString: 'assert($(".blue-text").css("color") === "rgb(0, 0, 255)", "Give your <code>h1</code> element with the text <code>I am blue!</code> the <code>color</code> blue.");' <ide> - text: Use <code>rgb</code> for the color blue. <del> testString: 'assert(code.match(/\.blue-text\s*?{\s*?color:\s*?rgb\(\s*?0\s*?,\s*?0\s*?,\s*?255\s*?\)\s*?;\s*?}/gi), ''Use <code>rgb</code> for the color blue.'');' <add> testString: 'assert(code.match(/\.blue-text\s*?{\s*?color:\s*?rgb\(\s*?0\s*?,\s*?0\s*?,\s*?255\s*?\)\s*?;\s*?}/gi), "Use <code>rgb</code> for the color blue.");' <ide> - text: Give your <code>h1</code> element with the text <code>I am sienna!</code> the <code>color</code> sienna. <del> testString: 'assert($(''.sienna-text'').css(''color'') === ''rgb(160, 82, 45)'', ''Give your <code>h1</code> element with the text <code>I am sienna!</code> the <code>color</code> sienna.'');' <add> testString: 'assert($(".sienna-text").css("color") === "rgb(160, 82, 45)", "Give your <code>h1</code> element with the text <code>I am sienna!</code> the <code>color</code> sienna.");' <ide> - text: Use <code>rgb</code> for the color sienna. <del> testString: 'assert(code.match(/\.sienna-text\s*?{\s*?color:\s*?rgb\(\s*?160\s*?,\s*?82\s*?,\s*?45\s*?\)\s*?;\s*?}/gi), ''Use <code>rgb</code> for the color sienna.'');' <add> testString: 'assert(code.match(/\.sienna-text\s*?{\s*?color:\s*?rgb\(\s*?160\s*?,\s*?82\s*?,\s*?45\s*?\)\s*?;\s*?}/gi), "Use <code>rgb</code> for the color sienna.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/use-rgb-values-to-color-elements.english.md <ide> Let's replace the hex code in our <code>body</code> element's background color w <ide> ```yml <ide> tests: <ide> - text: Your <code>body</code> element should have a black background. <del> testString: 'assert($("body").css("background-color") === "rgb(0, 0, 0)", ''Your <code>body</code> element should have a black background.'');' <add> testString: 'assert($("body").css("background-color") === "rgb(0, 0, 0)", "Your <code>body</code> element should have a black background.");' <ide> - text: Use <code>rgb</code> to give your <code>body</code> element a color of black. <del> testString: 'assert(code.match(/rgb\s*\(\s*0\s*,\s*0\s*,\s*0\s*\)/ig), ''Use <code>rgb</code> to give your <code>body</code> element a color of black.'');' <add> testString: 'assert(code.match(/rgb\s*\(\s*0\s*,\s*0\s*,\s*0\s*\)/ig), "Use <code>rgb</code> to give your <code>body</code> element a color of black.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-a-submit-button-to-a-form.english.md <ide> Add a button as the last element of your <code>form</code> element with a type o <ide> ```yml <ide> tests: <ide> - text: Your form should have a button inside it. <del> testString: 'assert($("form").children("button").length > 0, ''Your form should have a button inside it.'');' <add> testString: 'assert($("form").children("button").length > 0, "Your form should have a button inside it.");' <ide> - text: Your submit button should have the attribute <code>type</code> set to <code>submit</code>. <del> testString: 'assert($("button").attr("type") === "submit", ''Your submit button should have the attribute <code>type</code> set to <code>submit</code>.'');' <add> testString: 'assert($("button").attr("type") === "submit", "Your submit button should have the attribute <code>type</code> set to <code>submit</code>.");' <ide> - text: Your submit button should only have the text "Submit". <del> testString: 'assert($("button").text().match(/^\s*submit\s*$/gi), ''Your submit button should only have the text "Submit".'');' <add> testString: 'assert($("button").text().match(/^\s*submit\s*$/gi), "Your submit button should only have the text "Submit".");' <ide> - text: Make sure your <code>button</code> element has a closing tag. <del> testString: 'assert(code.match(/<\/button>/g) && code.match(/<button/g) && code.match(/<\/button>/g).length === code.match(/<button/g).length, ''Make sure your <code>button</code> element has a closing tag.'');' <add> testString: 'assert(code.match(/<\/button>/g) && code.match(/<button/g) && code.match(/<\/button>/g).length === code.match(/<button/g).length, "Make sure your <code>button</code> element has a closing tag.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2>CatPhotoApp</h2> <ide> <main> <ide> <p>Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <p>Things cats love:</p> <ide> <ul> <ide> <li>cat nip</li> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-images-to-your-website.english.md <ide> Finally don't forget to give your image an <code>alt</code> text. <ide> ```yml <ide> tests: <ide> - text: Your page should have an image element. <del> testString: 'assert($("img").length > 0, ''Your page should have an image element.'');' <add> testString: 'assert($("img").length > 0, "Your page should have an image element.");' <ide> - text: Your image should have a <code>src</code> attribute that points to the kitten image. <del> testString: 'assert(new RegExp("\/\/bit.ly\/fcc-relaxing-cat|\/\/s3.amazonaws.com\/freecodecamp\/relaxing-cat.jpg", "gi").test($("img").attr("src")), ''Your image should have a <code>src</code> attribute that points to the kitten image.'');' <add> testString: 'assert(new RegExp("\/\/bit.ly\/fcc-relaxing-cat|\/\/s3.amazonaws.com\/freecodecamp\/relaxing-cat.jpg", "gi").test($("img").attr("src")), "Your image should have a <code>src</code> attribute that points to the kitten image.");' <ide> - text: Your image element <strong>must</strong> have an <code>alt</code> attribute. <del> testString: 'assert(code.match(/alt\s*?=\s*?(\"|\'').*(\"|\'')/), ''Your image element <strong>must</strong> have an <code>alt</code> attribute.'');' <add> testString: 'assert(code.match(/alt\s*?=\s*?(\"|\").*(\"|\")/), "Your image element <strong>must</strong> have an <code>alt</code> attribute.");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```html <ide> <h2>CatPhotoApp</h2> <ide> <main> <del> <del> <add> <add> <ide> <p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p> <ide> <p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p> <ide> </main> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-placeholder-text-to-a-text-field.english.md <ide> Set the <code>placeholder</code> value of your text <code>input</code> to "cat p <ide> ```yml <ide> tests: <ide> - text: Add a <code>placeholder</code> attribute to the existing text <code>input</code> element. <del> testString: 'assert($("input[placeholder]").length > 0, ''Add a <code>placeholder</code> attribute to the existing text <code>input</code> element.'');' <add> testString: 'assert($("input[placeholder]").length > 0, "Add a <code>placeholder</code> attribute to the existing text <code>input</code> element.");' <ide> - text: Set the value of your placeholder attribute to "cat photo URL". <del> testString: 'assert($("input") && $("input").attr("placeholder") && $("input").attr("placeholder").match(/cat\s+photo\s+URL/gi), ''Set the value of your placeholder attribute to "cat photo URL".'');' <add> testString: 'assert($("input") && $("input").attr("placeholder") && $("input").attr("placeholder").match(/cat\s+photo\s+URL/gi), "Set the value of your placeholder attribute to "cat photo URL".");' <ide> - text: The finished <code>input</code> element should have valid syntax. <del> testString: 'assert($("input[type=text]").length > 0 && code.match(/<input((\s+\w+(\s*=\s*(?:".*?"|''.*?''|[\^''">\s]+))?)+\s*|\s*)\/?>/gi), ''The finished <code>input</code> element should have valid syntax.'');' <add> testString: 'assert($("input[type=text]").length > 0 && code.match(/<input((\s+\w+(\s*=\s*(?:".*?"|".*?"|[\^"">\s]+))?)+\s*|\s*)\/?>/gi), "The finished <code>input</code> element should have valid syntax.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2>CatPhotoApp</h2> <ide> <main> <ide> <p>Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <p>Things cats love:</p> <ide> <ul> <ide> <li>cat nip</li> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/check-radio-buttons-and-checkboxes-by-default.english.md <ide> Set the first of your <code>radio buttons</code> and the first of your <code>che <ide> ```yml <ide> tests: <ide> - text: Your first radio button on your form should be checked by default. <del> testString: 'assert($(''input[type="radio"]'').prop("checked"), ''Your first radio button on your form should be checked by default.'');' <add> testString: 'assert($("input[type="radio"]").prop("checked"), "Your first radio button on your form should be checked by default.");' <ide> - text: Your first checkbox on your form should be checked by default. <del> testString: 'assert($(''input[type="checkbox"]'').prop("checked"), ''Your first checkbox on your form should be checked by default.'');' <add> testString: 'assert($("input[type="checkbox"]").prop("checked"), "Your first checkbox on your form should be checked by default.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2>CatPhotoApp</h2> <ide> <main> <ide> <p>Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <p>Things cats love:</p> <ide> <ul> <ide> <li>cat nip</li> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/comment-out-html.english.md <ide> Comment out your <code>h1</code> element and your <code>p</code> element, but no <ide> ```yml <ide> tests: <ide> - text: Comment out your <code>h1</code> element so that it is not visible on your page. <del> testString: 'assert(($("h1").length === 0), ''Comment out your <code>h1</code> element so that it is not visible on your page.'');' <add> testString: 'assert(($("h1").length === 0), "Comment out your <code>h1</code> element so that it is not visible on your page.");' <ide> - text: Leave your <code>h2</code> element uncommented so that it is visible on your page. <del> testString: 'assert(($("h2").length > 0), ''Leave your <code>h2</code> element uncommented so that it is visible on your page.'');' <add> testString: 'assert(($("h2").length > 0), "Leave your <code>h2</code> element uncommented so that it is visible on your page.");' <ide> - text: Comment out your <code>p</code> element so that it is not visible on your page. <del> testString: 'assert(($("p").length === 0), ''Comment out your <code>p</code> element so that it is not visible on your page.'');' <add> testString: 'assert(($("p").length === 0), "Comment out your <code>p</code> element so that it is not visible on your page.");' <ide> - text: 'Be sure to close each of your comments with <code>--&#62;</code>.' <del> testString: 'assert(code.match(/[^fc]-->/g).length > 1, ''Be sure to close each of your comments with <code>--&#62;</code>.'');' <add> testString: 'assert(code.match(/[^fc]-->/g).length > 1, "Be sure to close each of your comments with <code>--&#62;</code>.");' <ide> - text: Do not change the order of the <code>h1</code> <code>h2</code> or <code>p</code> in the code. <del> testString: 'assert((code.match(/<([a-z0-9]){1,2}>/g)[0]==="<h1>" && code.match(/<([a-z0-9]){1,2}>/g)[1]==="<h2>" && code.match(/<([a-z0-9]){1,2}>/g)[2]==="<p>") , ''Do not change the order of the <code>h1</code> <code>h2</code> or <code>p</code> in the code.'');' <add> testString: 'assert((code.match(/<([a-z0-9]){1,2}>/g)[0]==="<h1>" && code.match(/<([a-z0-9]){1,2}>/g)[1]==="<h2>" && code.match(/<([a-z0-9]){1,2}>/g)[2]==="<p>") , "Do not change the order of the <code>h1</code> <code>h2</code> or <code>p</code> in the code.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-bulleted-unordered-list.english.md <ide> videoUrl: 'https://scrimba.com/p/pVMPUv/cDKVPuv' <ide> <section id='description'> <ide> HTML has a special element for creating <code>unordered lists</code>, or bullet point style lists. <ide> Unordered lists start with an opening <code>&#60;ul&#62;</code> element, followed by any number of <code>&#60;li&#62;</code> elements. Finally, unordered lists close with a <code>&#60;/ul&#62;</code> <del>For example: <add>For example: <ide> <blockquote>&#60;ul&#62;<br>&nbsp;&nbsp;&#60;li&#62;milk&#60;/li&#62;<br>&nbsp;&nbsp;&#60;li&#62;cheese&#60;/li&#62;<br>&#60;/ul&#62;</blockquote> <ide> would create a bullet point style list of "milk" and "cheese". <ide> </section> <ide> Remove the last two <code>p</code> elements and create an unordered list of thre <ide> ```yml <ide> tests: <ide> - text: Create a <code>ul</code> element. <del> testString: 'assert($("ul").length > 0, ''Create a <code>ul</code> element.'');' <add> testString: 'assert($("ul").length > 0, "Create a <code>ul</code> element.");' <ide> - text: You should have three <code>li</code> elements within your <code>ul</code> element. <del> testString: 'assert($("ul li").length > 2, ''You should have three <code>li</code> elements within your <code>ul</code> element.'');' <add> testString: 'assert($("ul li").length > 2, "You should have three <code>li</code> elements within your <code>ul</code> element.");' <ide> - text: Make sure your <code>ul</code> element has a closing tag. <del> testString: 'assert(code.match(/<\/ul>/gi) && code.match(/<ul/gi) && code.match(/<\/ul>/gi).length === code.match(/<ul/gi).length, ''Make sure your <code>ul</code> element has a closing tag.'');' <add> testString: 'assert(code.match(/<\/ul>/gi) && code.match(/<ul/gi) && code.match(/<\/ul>/gi).length === code.match(/<ul/gi).length, "Make sure your <code>ul</code> element has a closing tag.");' <ide> - text: Make sure your <code>li</code> elements have closing tags. <del> testString: 'assert(code.match(/<\/li>/gi) && code.match(/<li[\s>]/gi) && code.match(/<\/li>/gi).length === code.match(/<li[\s>]/gi).length, ''Make sure your <code>li</code> elements have closing tags.'');' <add> testString: 'assert(code.match(/<\/li>/gi) && code.match(/<li[\s>]/gi) && code.match(/<\/li>/gi).length === code.match(/<li[\s>]/gi).length, "Make sure your <code>li</code> elements have closing tags.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2>CatPhotoApp</h2> <ide> <main> <ide> <p>Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p> <ide> <p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p> <ide> </main> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-form-element.english.md <ide> Nest your text field inside a <code>form</code> element, and add the <code>actio <ide> ```yml <ide> tests: <ide> - text: Nest your text input element within a <code>form</code> element. <del> testString: 'assert($("form") && $("form").children("input") && $("form").children("input").length > 0, ''Nest your text input element within a <code>form</code> element.'');' <add> testString: 'assert($("form") && $("form").children("input") && $("form").children("input").length > 0, "Nest your text input element within a <code>form</code> element.");' <ide> - text: Make sure your <code>form</code> has an <code>action</code> attribute which is set to <code>/submit-cat-photo</code> <del> testString: 'assert($("form").attr("action") === "/submit-cat-photo", ''Make sure your <code>form</code> has an <code>action</code> attribute which is set to <code>/submit-cat-photo</code>'');' <add> testString: 'assert($("form").attr("action") === "/submit-cat-photo", "Make sure your <code>form</code> has an <code>action</code> attribute which is set to <code>/submit-cat-photo</code>");' <ide> - text: Make sure your <code>form</code> element has well-formed open and close tags. <del> testString: 'assert(code.match(/<\/form>/g) && code.match(/<form [^<]*>/g) && code.match(/<\/form>/g).length === code.match(/<form [^<]*>/g).length, ''Make sure your <code>form</code> element has well-formed open and close tags.'');' <add> testString: 'assert(code.match(/<\/form>/g) && code.match(/<form [^<]*>/g) && code.match(/<\/form>/g).length === code.match(/<form [^<]*>/g).length, "Make sure your <code>form</code> element has well-formed open and close tags.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2>CatPhotoApp</h2> <ide> <main> <ide> <p>Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <p>Things cats love:</p> <ide> <ul> <ide> <li>cat nip</li> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-set-of-checkboxes.english.md <ide> Add to your form a set of three checkboxes. Each checkbox should be nested withi <ide> ```yml <ide> tests: <ide> - text: Your page should have three checkbox elements. <del> testString: 'assert($(''input[type="checkbox"]'').length > 2, ''Your page should have three checkbox elements.'');' <add> testString: 'assert($("input[type="checkbox"]").length > 2, "Your page should have three checkbox elements.");' <ide> - text: Each of your three checkbox elements should be nested in its own <code>label</code> element. <del> testString: 'assert($(''label > input[type="checkbox"]:only-child'').length > 2, ''Each of your three checkbox elements should be nested in its own <code>label</code> element.'');' <add> testString: 'assert($("label > input[type="checkbox"]:only-child").length > 2, "Each of your three checkbox elements should be nested in its own <code>label</code> element.");' <ide> - text: Make sure each of your <code>label</code> elements has a closing tag. <del> testString: 'assert(code.match(/<\/label>/g) && code.match(/<label/g) && code.match(/<\/label>/g).length === code.match(/<label/g).length, ''Make sure each of your <code>label</code> elements has a closing tag.'');' <add> testString: 'assert(code.match(/<\/label>/g) && code.match(/<label/g) && code.match(/<\/label>/g).length === code.match(/<label/g).length, "Make sure each of your <code>label</code> elements has a closing tag.");' <ide> - text: Give your checkboxes the <code>name</code> attribute of <code>personality</code>. <del> testString: 'assert($(''label > input[type="checkbox"]'').filter("[name=''personality'']").length > 2, ''Give your checkboxes the <code>name</code> attribute of <code>personality</code>.'');' <add> testString: 'assert($("label > input[type="checkbox"]").filter("[name="personality"]").length > 2, "Give your checkboxes the <code>name</code> attribute of <code>personality</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2>CatPhotoApp</h2> <ide> <main> <ide> <p>Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <p>Things cats love:</p> <ide> <ul> <ide> <li>cat nip</li> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-set-of-radio-buttons.english.md <ide> Add a pair of radio buttons to your form, each nested in its own label element. <ide> ```yml <ide> tests: <ide> - text: Your page should have two radio button elements. <del> testString: 'assert($(''input[type="radio"]'').length > 1, ''Your page should have two radio button elements.'');' <add> testString: 'assert($("input[type="radio"]").length > 1, "Your page should have two radio button elements.");' <ide> - text: Give your radio buttons the <code>name</code> attribute of <code>indoor-outdoor</code>. <del> testString: 'assert($(''label > input[type="radio"]'').filter("[name=''indoor-outdoor'']").length > 1, ''Give your radio buttons the <code>name</code> attribute of <code>indoor-outdoor</code>.'');' <add> testString: 'assert($("label > input[type="radio"]").filter("[name="indoor-outdoor"]").length > 1, "Give your radio buttons the <code>name</code> attribute of <code>indoor-outdoor</code>.");' <ide> - text: Each of your two radio button elements should be nested in its own <code>label</code> element. <del> testString: 'assert($(''label > input[type="radio"]:only-child'').length > 1, ''Each of your two radio button elements should be nested in its own <code>label</code> element.'');' <add> testString: 'assert($("label > input[type="radio"]:only-child").length > 1, "Each of your two radio button elements should be nested in its own <code>label</code> element.");' <ide> - text: Make sure each of your <code>label</code> elements has a closing tag. <del> testString: 'assert((code.match(/<\/label>/g) && code.match(/<label/g) && code.match(/<\/label>/g).length === code.match(/<label/g).length), ''Make sure each of your <code>label</code> elements has a closing tag.'');' <add> testString: 'assert((code.match(/<\/label>/g) && code.match(/<label/g) && code.match(/<\/label>/g).length === code.match(/<label/g).length), "Make sure each of your <code>label</code> elements has a closing tag.");' <ide> - text: One of your radio buttons should have the label <code>indoor</code>. <del> testString: 'assert($("label").text().match(/indoor/gi), ''One of your radio buttons should have the label <code>indoor</code>.'');' <add> testString: 'assert($("label").text().match(/indoor/gi), "One of your radio buttons should have the label <code>indoor</code>.");' <ide> - text: One of your radio buttons should have the label <code>outdoor</code>. <del> testString: 'assert($("label").text().match(/outdoor/gi), ''One of your radio buttons should have the label <code>outdoor</code>.'');' <add> testString: 'assert($("label").text().match(/outdoor/gi), "One of your radio buttons should have the label <code>outdoor</code>.");' <ide> - text: Each of your radio button elements should be added within the <code>form</code> tag. <del> testString: 'assert($("label").parent().get(0).tagName.match(''FORM''), ''Each of your radio button elements should be added within the <code>form</code> tag.'');' <add> testString: 'assert($("label").parent().get(0).tagName.match("FORM"), "Each of your radio button elements should be added within the <code>form</code> tag.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2>CatPhotoApp</h2> <ide> <main> <ide> <p>Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <p>Things cats love:</p> <ide> <ul> <ide> <li>cat nip</li> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-text-field.english.md <ide> Create an <code>input</code> element of type <code>text</code> below your lists. <ide> ```yml <ide> tests: <ide> - text: Your app should have an <code>input</code> element of type <code>text</code>. <del> testString: 'assert($("input[type=text]").length > 0, ''Your app should have an <code>input</code> element of type <code>text</code>.'');' <add> testString: 'assert($("input[type=text]").length > 0, "Your app should have an <code>input</code> element of type <code>text</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2>CatPhotoApp</h2> <ide> <main> <ide> <p>Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <p>Things cats love:</p> <ide> <ul> <ide> <li>cat nip</li> <ide> tests: <ide> <li>thunder</li> <ide> <li>other cats</li> <ide> </ol> <del> <del> <add> <add> <ide> </main> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-an-ordered-list.english.md <ide> Create an ordered list of the top 3 things cats hate the most. <ide> ```yml <ide> tests: <ide> - text: 'You should have an ordered list for "Top 3 things cats hate:"' <del> testString: 'assert((/Top 3 things cats hate:/i).test($("ol").prev().text()), ''You should have an ordered list for "Top 3 things cats hate:"'');' <add> testString: 'assert((/Top 3 things cats hate:/i).test($("ol").prev().text()), "You should have an ordered list for "Top 3 things cats hate:"");' <ide> - text: 'You should have an unordered list for "Things cats love:"' <del> testString: 'assert((/Things cats love:/i).test($("ul").prev().text()), ''You should have an unordered list for "Things cats love:"'');' <add> testString: 'assert((/Things cats love:/i).test($("ul").prev().text()), "You should have an unordered list for "Things cats love:"");' <ide> - text: You should have only one <code>ul</code> element. <del> testString: 'assert.equal($("ul").length, 1, ''You should have only one <code>ul</code> element.'');' <add> testString: 'assert.equal($("ul").length, 1, "You should have only one <code>ul</code> element.");' <ide> - text: You should have only one <code>ol</code> element. <del> testString: 'assert.equal($("ol").length, 1, ''You should have only one <code>ol</code> element.'');' <add> testString: 'assert.equal($("ol").length, 1, "You should have only one <code>ol</code> element.");' <ide> - text: You should have three <code>li</code> elements within your <code>ul</code> element. <del> testString: 'assert.equal($("ul li").length, 3, ''You should have three <code>li</code> elements within your <code>ul</code> element.'');' <add> testString: 'assert.equal($("ul li").length, 3, "You should have three <code>li</code> elements within your <code>ul</code> element.");' <ide> - text: You should have three <code>li</code> elements within your <code>ol</code> element. <del> testString: 'assert.equal($("ol li").length, 3, ''You should have three <code>li</code> elements within your <code>ol</code> element.'');' <add> testString: 'assert.equal($("ol li").length, 3, "You should have three <code>li</code> elements within your <code>ol</code> element.");' <ide> - text: Make sure your <code>ul</code> element has a closing tag. <del> testString: 'assert(code.match(/<\/ul>/g) && code.match(/<\/ul>/g).length === code.match(/<ul>/g).length, ''Make sure your <code>ul</code> element has a closing tag.'');' <add> testString: 'assert(code.match(/<\/ul>/g) && code.match(/<\/ul>/g).length === code.match(/<ul>/g).length, "Make sure your <code>ul</code> element has a closing tag.");' <ide> - text: Make sure your <code>ol</code> element has a closing tag. <del> testString: 'assert(code.match(/<\/ol>/g) && code.match(/<\/ol>/g).length === code.match(/<ol>/g).length, ''Make sure your <code>ol</code> element has a closing tag.'');' <add> testString: 'assert(code.match(/<\/ol>/g) && code.match(/<\/ol>/g).length === code.match(/<ol>/g).length, "Make sure your <code>ol</code> element has a closing tag.");' <ide> - text: Make sure your <code>li</code> element has a closing tag. <del> testString: 'assert(code.match(/<\/li>/g) && code.match(/<li>/g) && code.match(/<\/li>/g).length === code.match(/<li>/g).length, ''Make sure your <code>li</code> element has a closing tag.'');' <add> testString: 'assert(code.match(/<\/li>/g) && code.match(/<li>/g) && code.match(/<\/li>/g).length === code.match(/<li>/g).length, "Make sure your <code>li</code> element has a closing tag.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2>CatPhotoApp</h2> <ide> <main> <ide> <p>Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <p>Things cats love:</p> <ide> <ul> <ide> <li>cat nip</li> <ide> <li>laser pointers</li> <ide> <li>lasagna</li> <ide> </ul> <ide> <p>Top 3 things cats hate:</p> <del> <add> <ide> </main> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/declare-the-doctype-of-an-html-document.english.md <ide> Add a <code>DOCTYPE</code> tag for HTML5 to the top of the blank HTML document i <ide> ```yml <ide> tests: <ide> - text: Your code should include a <code>&lt;!DOCTYPE html&gt;</code> tag. <del> testString: 'assert(code.match(/<!DOCTYPE\s+?html\s*?>/gi), ''Your code should include a <code>&lt;!DOCTYPE html&gt;</code> tag.'');' <add> testString: 'assert(code.match(/<!DOCTYPE\s+?html\s*?>/gi), "Your code should include a <code>&lt;!DOCTYPE html&gt;</code> tag.");' <ide> - text: There should be one <code>html</code> element. <del> testString: 'assert($(''html'').length == 1, ''There should be one <code>html</code> element.'');' <add> testString: 'assert($("html").length == 1, "There should be one <code>html</code> element.");' <ide> - text: The <code>html</code> tags should wrap around one <code>h1</code> element. <del> testString: 'assert(code.match(/<html>\s*?<h1>\s*?.*?\s*?<\/h1>\s*?<\/html>/gi), ''The <code>html</code> tags should wrap around one <code>h1</code> element.'');' <add> testString: 'assert(code.match(/<html>\s*?<h1>\s*?.*?\s*?<\/h1>\s*?<\/html>/gi), "The <code>html</code> tags should wrap around one <code>h1</code> element.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/define-the-head-and-body-of-an-html-document.english.md <ide> Edit the markup so there's a <code>head</code> and a <code>body</code>. The <cod <ide> ```yml <ide> tests: <ide> - text: There should be only one <code>head</code> element on the page. <del> testString: 'assert($(''head'').length == 1, ''There should be only one <code>head</code> element on the page.'');' <add> testString: 'assert($("head").length == 1, "There should be only one <code>head</code> element on the page.");' <ide> - text: There should be only one <code>body</code> element on the page. <del> testString: 'assert($(''body'').length == 1, ''There should be only one <code>body</code> element on the page.'');' <add> testString: 'assert($("body").length == 1, "There should be only one <code>body</code> element on the page.");' <ide> - text: The <code>head</code> element should be a child of the <code>html</code> element. <del> testString: 'assert($(''html'').children(''head'').length == 1, ''The <code>head</code> element should be a child of the <code>html</code> element.'');' <add> testString: 'assert($("html").children("head").length == 1, "The <code>head</code> element should be a child of the <code>html</code> element.");' <ide> - text: The <code>body</code> element should be a child of the <code>html</code> element. <del> testString: 'assert($(''html'').children(''body'').length == 1, ''The <code>body</code> element should be a child of the <code>html</code> element.'');' <add> testString: 'assert($("html").children("body").length == 1, "The <code>body</code> element should be a child of the <code>html</code> element.");' <ide> - text: The <code>head</code> element should wrap around the <code>title</code> element. <del> testString: 'assert(code.match(/<head>\s*?<title>\s*?.*?\s*?<\/title>\s*?<\/head>/gi), ''The <code>head</code> element should wrap around the <code>title</code> element.'');' <add> testString: 'assert(code.match(/<head>\s*?<title>\s*?.*?\s*?<\/title>\s*?<\/head>/gi), "The <code>head</code> element should wrap around the <code>title</code> element.");' <ide> - text: The <code>body</code> element should wrap around both the <code>h1</code> and <code>p</code> elements. <del> testString: 'assert($(''body'').children(''h1'').length == 1 && $(''body'').children(''p'').length == 1, ''The <code>body</code> element should wrap around both the <code>h1</code> and <code>p</code> elements.'');' <add> testString: 'assert($("body").children("h1").length == 1 && $("body").children("p").length == 1, "The <code>body</code> element should wrap around both the <code>h1</code> and <code>p</code> elements.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <!DOCTYPE html> <ide> <html> <ide> <title>The best page ever</title> <del> <add> <ide> <h1>The best page ever</h1> <ide> <p>Cat ipsum dolor sit amet, jump launch to pounce upon little yarn mouse, bare fangs at toy run hide in litter box until treats are fed. Go into a room to decide you didn't want to be in there anyway. I like big cats and i can not lie kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff. Meow i could pee on this if i had the energy for slap owner's face at 5am until human fills food dish yet scamper. Knock dish off table head butt cant eat out of my own dish scratch the furniture. Make meme, make cute face. Sleep in the bathroom sink chase laser but pee in the shoe. Paw at your fat belly licks your face and eat grass, throw it back up kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p> <del> <del></html> <add> <add></html> <ide> ``` <ide> <ide> </div> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/delete-html-elements.english.md <ide> Delete your <code>h1</code> element so we can simplify our view. <ide> ```yml <ide> tests: <ide> - text: Delete your <code>h1</code> element. <del> testString: 'assert(!code.match(/<h1>/gi) && !code.match(/<\/h1>/gi), ''Delete your <code>h1</code> element.'');' <add> testString: 'assert(!code.match(/<h1>/gi) && !code.match(/<\/h1>/gi), "Delete your <code>h1</code> element.");' <ide> - text: Leave your <code>h2</code> element on the page. <del> testString: 'assert(code.match(/<h2>[\w\W]*<\/h2>/gi), ''Leave your <code>h2</code> element on the page.'');' <add> testString: 'assert(code.match(/<h2>[\w\W]*<\/h2>/gi), "Leave your <code>h2</code> element on the page.");' <ide> - text: Leave your <code>p</code> element on the page. <del> testString: 'assert(code.match(/<p>[\w\W]*<\/p>/gi), ''Leave your <code>p</code> element on the page.'');' <add> testString: 'assert(code.match(/<p>[\w\W]*<\/p>/gi), "Leave your <code>p</code> element on the page.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/fill-in-the-blank-with-placeholder-text.english.md <ide> Replace the text inside your <code>p</code> element with the first few words of <ide> ```yml <ide> tests: <ide> - text: Your <code>p</code> element should contain the first few words of the provided <code>kitty ipsum text</code>. <del> testString: 'assert.isTrue((/Kitty(\s)+ipsum/gi).test($("p").text()), ''Your <code>p</code> element should contain the first few words of the provided <code>kitty ipsum text</code>.'');' <add> testString: 'assert.isTrue((/Kitty(\s)+ipsum/gi).test($("p").text()), "Your <code>p</code> element should contain the first few words of the provided <code>kitty ipsum text</code>.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/headline-with-the-h2-element.english.md <ide> Add an <code>h2</code> tag that says "CatPhotoApp" to create a second HTML <code <ide> ```yml <ide> tests: <ide> - text: Create an <code>h2</code> element. <del> testString: 'assert(($("h2").length > 0), ''Create an <code>h2</code> element.'');' <add> testString: 'assert(($("h2").length > 0), "Create an <code>h2</code> element.");' <ide> - text: Make sure your <code>h2</code> element has a closing tag. <del> testString: 'assert(code.match(/<\/h2>/g) && code.match(/<\/h2>/g).length === code.match(/<h2>/g).length, ''Make sure your <code>h2</code> element has a closing tag.'');' <add> testString: 'assert(code.match(/<\/h2>/g) && code.match(/<\/h2>/g).length === code.match(/<h2>/g).length, "Make sure your <code>h2</code> element has a closing tag.");' <ide> - text: Your <code>h2</code> element should have the text "CatPhotoApp". <del> testString: 'assert.isTrue((/cat(\s)?photo(\s)?app/gi).test($("h2").text()), ''Your <code>h2</code> element should have the text "CatPhotoApp".'');' <add> testString: 'assert.isTrue((/cat(\s)?photo(\s)?app/gi).test($("h2").text()), "Your <code>h2</code> element should have the text "CatPhotoApp".");' <ide> - text: Your <code>h1</code> element should have the text "Hello World". <del> testString: 'assert.isTrue((/hello(\s)+world/gi).test($("h1").text()), ''Your <code>h1</code> element should have the text "Hello World".'');' <add> testString: 'assert.isTrue((/hello(\s)+world/gi).test($("h1").text()), "Your <code>h1</code> element should have the text "Hello World".");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/inform-with-the-paragraph-element.english.md <ide> Create a <code>p</code> element below your <code>h2</code> element, and give it <ide> ```yml <ide> tests: <ide> - text: Create a <code>p</code> element. <del> testString: 'assert(($("p").length > 0), ''Create a <code>p</code> element.'');' <add> testString: 'assert(($("p").length > 0), "Create a <code>p</code> element.");' <ide> - text: Your <code>p</code> element should have the text "Hello Paragraph". <del> testString: 'assert.isTrue((/hello(\s)+paragraph/gi).test($("p").text()), ''Your <code>p</code> element should have the text "Hello Paragraph".'');' <add> testString: 'assert.isTrue((/hello(\s)+paragraph/gi).test($("p").text()), "Your <code>p</code> element should have the text "Hello Paragraph".");' <ide> - text: Make sure your <code>p</code> element has a closing tag. <del> testString: 'assert(code.match(/<\/p>/g) && code.match(/<\/p>/g).length === code.match(/<p/g).length, ''Make sure your <code>p</code> element has a closing tag.'');' <add> testString: 'assert(code.match(/<\/p>/g) && code.match(/<\/p>/g).length === code.match(/<p/g).length, "Make sure your <code>p</code> element has a closing tag.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/introduction-to-html5-elements.english.md <ide> Wrap the paragraphs with an opening and closing <code>main</code> tag. <ide> ```yml <ide> tests: <ide> - text: You need 2 <code>p</code> elements with Kitty Ipsum text. <del> testString: 'assert($("p").length > 1, ''You need 2 <code>p</code> elements with Kitty Ipsum text.'');' <add> testString: 'assert($("p").length > 1, "You need 2 <code>p</code> elements with Kitty Ipsum text.");' <ide> - text: Make sure each of your <code>p</code> elements has a closing tag. <del> testString: 'assert(code.match(/<\/p>/g) && code.match(/<\/p>/g).length === code.match(/<p/g).length, ''Make sure each of your <code>p</code> elements has a closing tag.'');' <add> testString: 'assert(code.match(/<\/p>/g) && code.match(/<\/p>/g).length === code.match(/<p/g).length, "Make sure each of your <code>p</code> elements has a closing tag.");' <ide> - text: Your <code>p</code> element should contain the first few words of the provided additional <code>kitty ipsum text</code>. <del> testString: 'assert.isTrue((/Purr\s+jump\s+eat/gi).test($("p").text()), ''Your <code>p</code> element should contain the first few words of the provided additional <code>kitty ipsum text</code>.'');' <add> testString: 'assert.isTrue((/Purr\s+jump\s+eat/gi).test($("p").text()), "Your <code>p</code> element should contain the first few words of the provided additional <code>kitty ipsum text</code>.");' <ide> - text: Your code should have one <code>main</code> element. <del> testString: 'assert($(''main'').length === 1, ''Your code should have one <code>main</code> element.'');' <add> testString: 'assert($("main").length === 1, "Your code should have one <code>main</code> element.");' <ide> - text: The <code>main</code> element should have two paragraph elements as children. <del> testString: 'assert($("main").children("p").length === 2, ''The <code>main</code> element should have two paragraph elements as children.'');' <add> testString: 'assert($("main").children("p").length === 2, "The <code>main</code> element should have two paragraph elements as children.");' <ide> - text: The opening <code>main</code> tag should come before the first paragraph tag. <del> testString: 'assert(code.match(/<main>\s*?<p>/g), ''The opening <code>main</code> tag should come before the first paragraph tag.'');' <add> testString: 'assert(code.match(/<main>\s*?<p>/g), "The opening <code>main</code> tag should come before the first paragraph tag.");' <ide> - text: The closing <code>main</code> tag should come after the second closing paragraph tag. <del> testString: 'assert(code.match(/<\/p>\s*?<\/main>/g), ''The closing <code>main</code> tag should come after the second closing paragraph tag.'');' <add> testString: 'assert(code.match(/<\/p>\s*?<\/main>/g), "The closing <code>main</code> tag should come after the second closing paragraph tag.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/link-to-external-pages-with-anchor-elements.english.md <ide> Create an <code>a</code> element that links to <code>http://freecatphotoapp.com< <ide> ```yml <ide> tests: <ide> - text: Your <code>a</code> element should have the <code>anchor text</code> of "cat photos". <del> testString: 'assert((/cat photos/gi).test($("a").text()), ''Your <code>a</code> element should have the <code>anchor text</code> of "cat photos".'');' <add> testString: 'assert((/cat photos/gi).test($("a").text()), "Your <code>a</code> element should have the <code>anchor text</code> of "cat photos".");' <ide> - text: 'You need an <code>a</code> element that links to <code>http&#58;//freecatphotoapp<wbr>.com</code>' <del> testString: 'assert(/http:\/\/(www\.)?freecatphotoapp\.com/gi.test($("a").attr("href")), ''You need an <code>a</code> element that links to <code>http&#58;//freecatphotoapp<wbr>.com</code>'');' <add> testString: 'assert(/http:\/\/(www\.)?freecatphotoapp\.com/gi.test($("a").attr("href")), "You need an <code>a</code> element that links to <code>http&#58;//freecatphotoapp<wbr>.com</code>");' <ide> - text: Make sure your <code>a</code> element has a closing tag. <del> testString: 'assert(code.match(/<\/a>/g) && code.match(/<\/a>/g).length === code.match(/<a/g).length, ''Make sure your <code>a</code> element has a closing tag.'');' <add> testString: 'assert(code.match(/<\/a>/g) && code.match(/<\/a>/g).length === code.match(/<a/g).length, "Make sure your <code>a</code> element has a closing tag.");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```html <ide> <h2>CatPhotoApp</h2> <ide> <main> <del> <del> <del> <add> <add> <add> <ide> <img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."> <del> <add> <ide> <p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p> <ide> <p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p> <ide> </main> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/link-to-internal-sections-of-a-page-with-anchor-elements.english.md <ide> Then add an <code>id</code> attribute with a value of "footer" to the <code>&lt; <ide> ```yml <ide> tests: <ide> - text: There should be only one anchor tag on your page. <del> testString: 'assert($(''a'').length == 1, ''There should be only one anchor tag on your page.'');' <add> testString: 'assert($("a").length == 1, "There should be only one anchor tag on your page.");' <ide> - text: There should be only one <code>footer</code> tag on your page. <del> testString: 'assert($(''footer'').length == 1, ''There should be only one <code>footer</code> tag on your page.'');' <add> testString: 'assert($("footer").length == 1, "There should be only one <code>footer</code> tag on your page.");' <ide> - text: 'The <code>a</code> tag should have an <code>href</code> attribute set to "#footer".' <del> testString: 'assert($(''a'').eq(0).attr(''href'') == "#footer", ''The <code>a</code> tag should have an <code>href</code> attribute set to "#footer".'');' <add> testString: 'assert($("a").eq(0).attr("href") == "#footer", "The <code>a</code> tag should have an <code>href</code> attribute set to "#footer".");' <ide> - text: The <code>a</code> tag should not have a <code>target</code> attribute <del> testString: 'assert(typeof $(''a'').eq(0).attr(''target'') == typeof undefined || $(''a'').eq(0).attr(''target'') == true, ''The <code>a</code> tag should not have a <code>target</code> attribute'');' <add> testString: 'assert(typeof $("a").eq(0).attr("target") == typeof undefined || $("a").eq(0).attr("target") == true, "The <code>a</code> tag should not have a <code>target</code> attribute");' <ide> - text: The <code>a</code> text should be "Jump to Bottom". <del> testString: 'assert($(''a'').eq(0).text().match(/Jump to Bottom/gi), ''The <code>a</code> text should be "Jump to Bottom".'');' <add> testString: 'assert($("a").eq(0).text().match(/Jump to Bottom/gi), "The <code>a</code> text should be "Jump to Bottom".");' <ide> - text: The <code>footer</code> tag should have an <code>id</code> attribute set to "footer". <del> testString: 'assert($(''footer'').eq(0).attr(''id'') == "footer", ''The <code>footer</code> tag should have an <code>id</code> attribute set to "footer".'');' <add> testString: 'assert($("footer").eq(0).attr("id") == "footer", "The <code>footer</code> tag should have an <code>id</code> attribute set to "footer".");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```html <ide> <h2>CatPhotoApp</h2> <ide> <main> <del> <add> <ide> <a href="http://freecatphotoapp.com" target="_blank">cat photos</a> <del> <add> <ide> <img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."> <del> <add> <ide> <p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff. Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched. Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p> <ide> <p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched. Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff. Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p> <ide> <p>Meowwww loved it, hated it, loved it, hated it yet spill litter box, scratch at owner, destroy all furniture, especially couch or lay on arms while you're using the keyboard. Missing until dinner time toy mouse squeak roll over. With tail in the air lounge in doorway. Man running from cops stops to pet cats, goes to jail.</p> <ide> <p>Intently stare at the same spot poop in the plant pot but kitten is playing with dead mouse. Get video posted to internet for chasing red dot leave fur on owners clothes meow to be let out and mesmerizing birds leave fur on owners clothes or favor packaging over toy so purr for no reason. Meow to be let out play time intently sniff hand run outside as soon as door open yet destroy couch.</p> <del> <add> <ide> </main> <del> <add> <ide> <footer>Copyright Cat Photo App</footer> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/make-dead-links-using-the-hash-symbol.english.md <ide> For example: <code>href="#"</code> <ide> ```yml <ide> tests: <ide> - text: 'Your <code>a</code> element should be a dead link with the value of the <code>href</code> attribute set to "#".' <del> testString: 'assert($("a").attr("href") === "#", ''Your <code>a</code> element should be a dead link with the value of the <code>href</code> attribute set to "#".'');' <add> testString: 'assert($("a").attr("href") === "#", "Your <code>a</code> element should be a dead link with the value of the <code>href</code> attribute set to "#".");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2>CatPhotoApp</h2> <ide> <main> <ide> <p>Click here to view more <a href="http://freecatphotoapp.com" target="_blank">cat photos</a>.</p> <del> <add> <ide> <img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."> <del> <add> <ide> <p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p> <ide> <p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p> <ide> </main> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/nest-an-anchor-element-within-a-paragraph.english.md <ide> Now nest your existing <code>a</code> element within a new <code>p</code> elemen <ide> ```yml <ide> tests: <ide> - text: 'You need an <code>a</code> element that links to "http://freecatphotoapp.com".' <del> testString: 'assert(($("a[href=\"http://freecatphotoapp.com\"]").length > 0 || $("a[href=\"http://www.freecatphotoapp.com\"]").length > 0), ''You need an <code>a</code> element that links to "http://freecatphotoapp.com".'');' <add> testString: 'assert(($("a[href=\"http://freecatphotoapp.com\"]").length > 0 || $("a[href=\"http://www.freecatphotoapp.com\"]").length > 0), "You need an <code>a</code> element that links to "http://freecatphotoapp.com".");' <ide> - text: Your <code>a</code> element should have the anchor text of "cat photos" <del> testString: 'assert($("a").text().match(/cat\sphotos/gi), ''Your <code>a</code> element should have the anchor text of "cat photos"'');' <add> testString: 'assert($("a").text().match(/cat\sphotos/gi), "Your <code>a</code> element should have the anchor text of "cat photos"");' <ide> - text: Create a new <code>p</code> element around your <code>a</code> element. There should be at least 3 total <code>p</code> tags in your HTML code. <del> testString: 'assert($("p") && $("p").length > 2, ''Create a new <code>p</code> element around your <code>a</code> element. There should be at least 3 total <code>p</code> tags in your HTML code.'');' <add> testString: 'assert($("p") && $("p").length > 2, "Create a new <code>p</code> element around your <code>a</code> element. There should be at least 3 total <code>p</code> tags in your HTML code.");' <ide> - text: Your <code>a</code> element should be nested within your new <code>p</code> element. <del> testString: 'assert(($("a[href=\"http://freecatphotoapp.com\"]").parent().is("p") || $("a[href=\"http://www.freecatphotoapp.com\"]").parent().is("p")), ''Your <code>a</code> element should be nested within your new <code>p</code> element.'');' <add> testString: 'assert(($("a[href=\"http://freecatphotoapp.com\"]").parent().is("p") || $("a[href=\"http://www.freecatphotoapp.com\"]").parent().is("p")), "Your <code>a</code> element should be nested within your new <code>p</code> element.");' <ide> - text: Your <code>p</code> element should have the text "View more " (with a space after it). <del> testString: 'assert(($("a[href=\"http://freecatphotoapp.com\"]").parent().text().match(/View\smore\s/gi) || $("a[href=\"http://www.freecatphotoapp.com\"]").parent().text().match(/View\smore\s/gi)), ''Your <code>p</code> element should have the text "View more " (with a space after it).'');' <add> testString: 'assert(($("a[href=\"http://freecatphotoapp.com\"]").parent().text().match(/View\smore\s/gi) || $("a[href=\"http://www.freecatphotoapp.com\"]").parent().text().match(/View\smore\s/gi)), "Your <code>p</code> element should have the text "View more " (with a space after it).");' <ide> - text: Your <code>a</code> element should <em>not</em> have the text "View more". <del> testString: 'assert(!$("a").text().match(/View\smore/gi), ''Your <code>a</code> element should <em>not</em> have the text "View more".'');' <add> testString: 'assert(!$("a").text().match(/View\smore/gi), "Your <code>a</code> element should <em>not</em> have the text "View more".");' <ide> - text: Make sure each of your <code>p</code> elements has a closing tag. <del> testString: 'assert(code.match(/<\/p>/g) && code.match(/<p/g) && code.match(/<\/p>/g).length === code.match(/<p/g).length, ''Make sure each of your <code>p</code> elements has a closing tag.'');' <add> testString: 'assert(code.match(/<\/p>/g) && code.match(/<p/g) && code.match(/<\/p>/g).length === code.match(/<p/g).length, "Make sure each of your <code>p</code> elements has a closing tag.");' <ide> - text: Make sure each of your <code>a</code> elements has a closing tag. <del> testString: 'assert(code.match(/<\/a>/g) && code.match(/<a/g) && code.match(/<\/a>/g).length === code.match(/<a/g).length, ''Make sure each of your <code>a</code> elements has a closing tag.'');' <add> testString: 'assert(code.match(/<\/a>/g) && code.match(/<a/g) && code.match(/<\/a>/g).length === code.match(/<a/g).length, "Make sure each of your <code>a</code> elements has a closing tag.");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```html <ide> <h2>CatPhotoApp</h2> <ide> <main> <del> <add> <ide> <a href="http://freecatphotoapp.com" target="_blank">cat photos</a> <del> <add> <ide> <img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."> <del> <add> <ide> <p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p> <ide> <p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p> <ide> </main> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/nest-many-elements-within-a-single-div-element.english.md <ide> Hint: Try putting your opening <code>div</code> tag above your "Things cats love <ide> ```yml <ide> tests: <ide> - text: Nest your <code>p</code> elements inside your <code>div</code> element. <del> testString: 'assert($("div").children("p").length > 1, ''Nest your <code>p</code> elements inside your <code>div</code> element.'');' <add> testString: 'assert($("div").children("p").length > 1, "Nest your <code>p</code> elements inside your <code>div</code> element.");' <ide> - text: Nest your <code>ul</code> element inside your <code>div</code> element. <del> testString: 'assert($("div").children("ul").length > 0, ''Nest your <code>ul</code> element inside your <code>div</code> element.'');' <add> testString: 'assert($("div").children("ul").length > 0, "Nest your <code>ul</code> element inside your <code>div</code> element.");' <ide> - text: Nest your <code>ol</code> element inside your <code>div</code> element. <del> testString: 'assert($("div").children("ol").length > 0, ''Nest your <code>ol</code> element inside your <code>div</code> element.'');' <add> testString: 'assert($("div").children("ol").length > 0, "Nest your <code>ol</code> element inside your <code>div</code> element.");' <ide> - text: Make sure your <code>div</code> element has a closing tag. <del> testString: 'assert(code.match(/<\/div>/g) && code.match(/<\/div>/g).length === code.match(/<div>/g).length, ''Make sure your <code>div</code> element has a closing tag.'');' <add> testString: 'assert(code.match(/<\/div>/g) && code.match(/<\/div>/g).length === code.match(/<div>/g).length, "Make sure your <code>div</code> element has a closing tag.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2>CatPhotoApp</h2> <ide> <main> <ide> <p>Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <p>Things cats love:</p> <ide> <ul> <ide> <li>cat nip</li> <ide> tests: <ide> <li>thunder</li> <ide> <li>other cats</li> <ide> </ol> <del> <add> <ide> <form action="/submit-cat-photo"> <ide> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label> <ide> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/say-hello-to-html-elements.english.md <ide> To pass the test on this challenge, change your <code>h1</code> element's text t <ide> ```yml <ide> tests: <ide> - text: Your <code>h1</code> element should have the text "Hello World". <del> testString: 'assert.isTrue((/hello(\s)+world/gi).test($(''h1'').text()), ''Your <code>h1</code> element should have the text "Hello World".'');' <add> testString: 'assert.isTrue((/hello(\s)+world/gi).test($("h1").text()), "Your <code>h1</code> element should have the text "Hello World".");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/turn-an-image-into-a-link.english.md <ide> Once you've done this, hover over your image with your cursor. Your cursor's nor <ide> ```yml <ide> tests: <ide> - text: Nest the existing <code>img</code> element within an <code>a</code> element. <del> testString: 'assert($("a").children("img").length > 0, ''Nest the existing <code>img</code> element within an <code>a</code> element.'');' <add> testString: 'assert($("a").children("img").length > 0, "Nest the existing <code>img</code> element within an <code>a</code> element.");' <ide> - text: 'Your <code>a</code> element should be a dead link with a <code>href</code> attribute set to <code>#</code>.' <del> testString: 'assert(new RegExp("#").test($("a").children("img").parent().attr("href")), ''Your <code>a</code> element should be a dead link with a <code>href</code> attribute set to <code>#</code>.'');' <add> testString: 'assert(new RegExp("#").test($("a").children("img").parent().attr("href")), "Your <code>a</code> element should be a dead link with a <code>href</code> attribute set to <code>#</code>.");' <ide> - text: Make sure each of your <code>a</code> elements has a closing tag. <del> testString: 'assert(code.match(/<\/a>/g) && code.match(/<a/g) && code.match(/<\/a>/g).length === code.match(/<a/g).length, ''Make sure each of your <code>a</code> elements has a closing tag.'');' <add> testString: 'assert(code.match(/<\/a>/g) && code.match(/<a/g) && code.match(/<\/a>/g).length === code.match(/<a/g).length, "Make sure each of your <code>a</code> elements has a closing tag.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2>CatPhotoApp</h2> <ide> <main> <ide> <p>Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."> <del> <add> <ide> <p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p> <ide> <p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p> <ide> </main> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/uncomment-html.english.md <ide> Uncomment your <code>h1</code>, <code>h2</code> and <code>p</code> elements. <ide> ```yml <ide> tests: <ide> - text: Make your <code>h1</code> element visible on your page by uncommenting it. <del> testString: 'assert($("h1").length > 0, ''Make your <code>h1</code> element visible on your page by uncommenting it.'');' <add> testString: 'assert($("h1").length > 0, "Make your <code>h1</code> element visible on your page by uncommenting it.");' <ide> - text: Make your <code>h2</code> element visible on your page by uncommenting it. <del> testString: 'assert($("h2").length > 0, ''Make your <code>h2</code> element visible on your page by uncommenting it.'');' <add> testString: 'assert($("h2").length > 0, "Make your <code>h2</code> element visible on your page by uncommenting it.");' <ide> - text: Make your <code>p</code> element visible on your page by uncommenting it. <del> testString: 'assert($("p").length > 0, ''Make your <code>p</code> element visible on your page by uncommenting it.'');' <add> testString: 'assert($("p").length > 0, "Make your <code>p</code> element visible on your page by uncommenting it.");' <ide> - text: 'Be sure to delete all trailing comment tags&#44; i.e. <code>--&#62;</code>.' <del> testString: 'assert(!/[^fc]-->/gi.test(code.replace(/ *<!--[^fc]*\n/g,'''')), ''Be sure to delete all trailing comment tags&#44; i.e. <code>--&#62;</code>.'');' <add> testString: 'assert(!/[^fc]-->/gi.test(code.replace(/ *<!--[^fc]*\n/g,"")), "Be sure to delete all trailing comment tags&#44; i.e. <code>--&#62;</code>.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/use-html5-to-require-a-field.english.md <ide> Then try to submit the form without inputting any text. See how your HTML5 form <ide> ```yml <ide> tests: <ide> - text: Your text <code>input</code> element should have the <code>required</code> attribute. <del> testString: 'assert($("input").prop("required"), ''Your text <code>input</code> element should have the <code>required</code> attribute.'');' <add> testString: 'assert($("input").prop("required"), "Your text <code>input</code> element should have the <code>required</code> attribute.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <h2>CatPhotoApp</h2> <ide> <main> <ide> <p>Click here to view more <a href="#">cat photos</a>.</p> <del> <add> <ide> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <del> <add> <ide> <p>Things cats love:</p> <ide> <ul> <ide> <li>cat nip</li> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-flexbox/add-flex-superpowers-to-the-tweet-embed.english.md <ide> Add the CSS property <code>display: flex</code> to all of the following items - <ide> ```yml <ide> tests: <ide> - text: Your <code>header</code> should have a <code>display</code> property set to flex. <del> testString: 'assert($(''header'').css(''display'') == ''flex'', ''Your <code>header</code> should have a <code>display</code> property set to flex.'');' <add> testString: 'assert($("header").css("display") == "flex", "Your <code>header</code> should have a <code>display</code> property set to flex.");' <ide> - text: Your <code>footer</code> should have a <code>display</code> property set to flex. <del> testString: 'assert($(''footer'').css(''display'') == ''flex'', ''Your <code>footer</code> should have a <code>display</code> property set to flex.'');' <add> testString: 'assert($("footer").css("display") == "flex", "Your <code>footer</code> should have a <code>display</code> property set to flex.");' <ide> - text: Your <code>h3</code> should have a <code>display</code> property set to flex. <del> testString: 'assert($(''h3'').css(''display'') == ''flex'', ''Your <code>h3</code> should have a <code>display</code> property set to flex.'');' <add> testString: 'assert($("h3").css("display") == "flex", "Your <code>h3</code> should have a <code>display</code> property set to flex.");' <ide> - text: Your <code>h4</code> should have a <code>display</code> property set to flex. <del> testString: 'assert($(''h4'').css(''display'') == ''flex'', ''Your <code>h4</code> should have a <code>display</code> property set to flex.'');' <add> testString: 'assert($("h4").css("display") == "flex", "Your <code>h4</code> should have a <code>display</code> property set to flex.");' <ide> - text: Your <code>.profile-name</code> should have a <code>display</code> property set to flex. <del> testString: 'assert($(''.profile-name'').css(''display'') == ''flex'', ''Your <code>.profile-name</code> should have a <code>display</code> property set to flex.'');' <add> testString: 'assert($(".profile-name").css("display") == "flex", "Your <code>.profile-name</code> should have a <code>display</code> property set to flex.");' <ide> - text: Your <code>.follow-btn</code> should have a <code>display</code> property set to flex. <del> testString: 'assert($(''.follow-btn'').css(''display'') == ''flex'', ''Your <code>.follow-btn</code> should have a <code>display</code> property set to flex.'');' <add> testString: 'assert($(".follow-btn").css("display") == "flex", "Your <code>.follow-btn</code> should have a <code>display</code> property set to flex.");' <ide> - text: Your <code>.stats</code> should have a <code>display</code> property set to flex. <del> testString: 'assert($(''.stats'').css(''display'') == ''flex'', ''Your <code>.stats</code> should have a <code>display</code> property set to flex.'');' <add> testString: 'assert($(".stats").css("display") == "flex", "Your <code>.stats</code> should have a <code>display</code> property set to flex.");' <ide> <ide> ``` <ide> <ide> tests: <ide> font-family: Arial, sans-serif; <ide> } <ide> header { <del> <add> <ide> } <ide> header .profile-thumbnail { <ide> width: 50px; <ide> height: 50px; <ide> border-radius: 4px; <ide> } <ide> header .profile-name { <del> <add> <ide> margin-left: 10px; <ide> } <ide> header .follow-btn { <del> <add> <ide> margin: 0 0 0 auto; <ide> } <ide> header .follow-btn button { <ide> tests: <ide> padding: 5px; <ide> } <ide> header h3, header h4 { <del> <add> <ide> margin: 0; <ide> } <ide> #inner p { <ide> tests: <ide> opacity: 0.1; <ide> } <ide> footer { <del> <add> <ide> } <ide> footer .stats { <del> <add> <ide> font-size: 15px; <ide> } <ide> footer .stats strong { <ide><path>curriculum/challenges/english/01-responsive-web-design/css-flexbox/align-elements-using-the-align-items-property.english.md <ide> An example helps show this property in action. Add the CSS property <code>align- <ide> ```yml <ide> tests: <ide> - text: 'The <code>#box-container</code> element should have an <code>align-items</code> property set to a value of center.' <del> testString: 'assert($(''#box-container'').css(''align-items'') == ''center'', ''The <code>#box-container</code> element should have an <code>align-items</code> property set to a value of center.'');' <add> testString: 'assert($("#box-container").css("align-items") == "center", "The <code>#box-container</code> element should have an <code>align-items</code> property set to a value of center.");' <ide> <ide> ``` <ide> <ide> tests: <ide> background: gray; <ide> display: flex; <ide> height: 500px; <del> <add> <ide> } <ide> #box-1 { <ide> background-color: dodgerblue; <ide><path>curriculum/challenges/english/01-responsive-web-design/css-flexbox/align-elements-using-the-justify-content-property.english.md <ide> An example helps show this property in action. Add the CSS property <code>justif <ide> ```yml <ide> tests: <ide> - text: 'The <code>#box-container</code> element should have a <code>justify-content</code> property set to a value of center.' <del> testString: 'assert($(''#box-container'').css(''justify-content'') == ''center'', ''The <code>#box-container</code> element should have a <code>justify-content</code> property set to a value of center.'');' <add> testString: 'assert($("#box-container").css("justify-content") == "center", "The <code>#box-container</code> element should have a <code>justify-content</code> property set to a value of center.");' <ide> <ide> ``` <ide> <ide> tests: <ide> background: gray; <ide> display: flex; <ide> height: 500px; <del> <add> <ide> } <ide> #box-1 { <ide> background-color: dodgerblue; <ide><path>curriculum/challenges/english/01-responsive-web-design/css-flexbox/apply-the-flex-direction-property-to-create-a-column-in-the-tweet-embed.english.md <ide> Add the CSS property <code>flex-direction</code> to the header's <code>.profile- <ide> ```yml <ide> tests: <ide> - text: The <code>.profile-name</code> element should have a <code>flex-direction</code> property set to column. <del> testString: 'assert($(''.profile-name'').css(''flex-direction'') == ''column'', ''The <code>.profile-name</code> element should have a <code>flex-direction</code> property set to column.'');' <add> testString: 'assert($(".profile-name").css("flex-direction") == "column", "The <code>.profile-name</code> element should have a <code>flex-direction</code> property set to column.");' <ide> <ide> ``` <ide> <ide> tests: <ide> } <ide> header .profile-name { <ide> display: flex; <del> <add> <ide> margin-left: 10px; <ide> } <ide> header .follow-btn { <ide><path>curriculum/challenges/english/01-responsive-web-design/css-flexbox/apply-the-flex-direction-property-to-create-rows-in-the-tweet-embed.english.md <ide> Add the CSS property <code>flex-direction</code> to both the <code>header</code> <ide> ```yml <ide> tests: <ide> - text: The <code>header</code> should have a <code>flex-direction</code> property set to row. <del> testString: 'assert(code.match(/header\s*?{[^}]*?flex-direction:\s*?row;/g), ''The <code>header</code> should have a <code>flex-direction</code> property set to row.'');' <add> testString: 'assert(code.match(/header\s*?{[^}]*?flex-direction:\s*?row;/g), "The <code>header</code> should have a <code>flex-direction</code> property set to row.");' <ide> - text: The <code>footer</code> should have a <code>flex-direction</code> property set to row. <del> testString: 'assert(code.match(/footer\s*?{[^}]*?flex-direction:\s*?row;/g), ''The <code>footer</code> should have a <code>flex-direction</code> property set to row.'');' <add> testString: 'assert(code.match(/footer\s*?{[^}]*?flex-direction:\s*?row;/g), "The <code>footer</code> should have a <code>flex-direction</code> property set to row.");' <ide> <ide> ``` <ide> <ide> tests: <ide> } <ide> header { <ide> display: flex; <del> <add> <ide> } <ide> header .profile-thumbnail { <ide> width: 50px; <ide> tests: <ide> } <ide> footer { <ide> display: flex; <del> <add> <ide> } <ide> footer .stats { <ide> display: flex; <ide><path>curriculum/challenges/english/01-responsive-web-design/css-flexbox/use-display-flex-to-position-two-boxes.english.md <ide> Add the CSS property <code>display</code> to <code>#box-container</code> and set <ide> ```yml <ide> tests: <ide> - text: '<code>#box-container</code> should have the <code>display</code> property set to a value of flex.' <del> testString: 'assert($(''#box-container'').css(''display'') == ''flex'', ''<code>#box-container</code> should have the <code>display</code> property set to a value of flex.'');' <add> testString: 'assert($("#box-container").css("display") == "flex", "<code>#box-container</code> should have the <code>display</code> property set to a value of flex.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <style> <ide> #box-container { <ide> height: 500px; <del> <add> <ide> } <del> <add> <ide> #box-1 { <ide> background-color: dodgerblue; <ide> width: 50%; <ide> height: 50%; <del> <add> <ide> } <ide> <ide> #box-2 { <ide> background-color: orangered; <ide> width: 50%; <ide> height: 50%; <del> <add> <ide> } <ide> </style> <ide> <div id="box-container"> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-flexbox/use-the-align-items-property-in-the-tweet-embed.english.md <ide> Add the CSS property <code>align-items</code> to the header's <code>.follow-btn< <ide> ```yml <ide> tests: <ide> - text: The <code>.follow-btn</code> element should have the <code>align-items</code> property set to a value of center. <del> testString: 'assert($(''.follow-btn'').css(''align-items'') == ''center'', ''The <code>.follow-btn</code> element should have the <code>align-items</code> property set to a value of center.'');' <add> testString: 'assert($(".follow-btn").css("align-items") == "center", "The <code>.follow-btn</code> element should have the <code>align-items</code> property set to a value of center.");' <ide> <ide> ``` <ide> <ide> tests: <ide> } <ide> header .follow-btn { <ide> display: flex; <del> <add> <ide> margin: 0 0 0 auto; <ide> } <ide> header .follow-btn button { <ide> tests: <ide> } <ide> header h3, header h4 { <ide> display: flex; <del> <add> <ide> margin: 0; <ide> } <ide> #inner p { <ide><path>curriculum/challenges/english/01-responsive-web-design/css-flexbox/use-the-align-self-property.english.md <ide> Add the CSS property <code>align-self</code> to both <code>#box-1</code> and <co <ide> ```yml <ide> tests: <ide> - text: 'The <code>#box-1</code> element should have the <code>align-self</code> property set to a value of center.' <del> testString: 'assert($(''#box-1'').css(''align-self'') == ''center'', ''The <code>#box-1</code> element should have the <code>align-self</code> property set to a value of center.'');' <add> testString: 'assert($("#box-1").css("align-self") == "center", "The <code>#box-1</code> element should have the <code>align-self</code> property set to a value of center.");' <ide> - text: 'The <code>#box-2</code> element should have the <code>align-self</code> property set to a value of flex-end.' <del> testString: 'assert($(''#box-2'').css(''align-self'') == ''flex-end'', ''The <code>#box-2</code> element should have the <code>align-self</code> property set to a value of flex-end.'');' <add> testString: 'assert($("#box-2").css("align-self") == "flex-end", "The <code>#box-2</code> element should have the <code>align-self</code> property set to a value of flex-end.");' <ide> <ide> ``` <ide> <ide> tests: <ide> } <ide> #box-1 { <ide> background-color: dodgerblue; <del> <add> <ide> height: 200px; <ide> width: 200px; <ide> } <ide> <ide> #box-2 { <ide> background-color: orangered; <del> <add> <ide> height: 200px; <ide> width: 200px; <ide> } <ide><path>curriculum/challenges/english/01-responsive-web-design/css-flexbox/use-the-flex-basis-property-to-set-the-initial-size-of-an-item.english.md <ide> Set the initial size of the boxes using <code>flex-basis</code>. Add the CSS pro <ide> ```yml <ide> tests: <ide> - text: 'The <code>#box-1</code> element should have a <code>flex-basis</code> property.' <del> testString: 'assert($(''#box-1'').css(''flex-basis'') != ''auto'', ''The <code>#box-1</code> element should have a <code>flex-basis</code> property.'');' <add> testString: 'assert($("#box-1").css("flex-basis") != "auto", "The <code>#box-1</code> element should have a <code>flex-basis</code> property.");' <ide> - text: 'The <code>#box-1</code> element should have a <code>flex-basis</code> value of <code>10em</code>.' <del> testString: 'assert(code.match(/#box-1\s*?{\s*?.*?\s*?.*?\s*?flex-basis:\s*?10em;/g), ''The <code>#box-1</code> element should have a <code>flex-basis</code> value of <code>10em</code>.'');' <add> testString: 'assert(code.match(/#box-1\s*?{\s*?.*?\s*?.*?\s*?flex-basis:\s*?10em;/g), "The <code>#box-1</code> element should have a <code>flex-basis</code> value of <code>10em</code>.");' <ide> - text: 'The <code>#box-2</code> element should have the <code>flex-basis</code> property.' <del> testString: 'assert($(''#box-2'').css(''flex-basis'') != ''auto'', ''The <code>#box-2</code> element should have the <code>flex-basis</code> property.'');' <add> testString: 'assert($("#box-2").css("flex-basis") != "auto", "The <code>#box-2</code> element should have the <code>flex-basis</code> property.");' <ide> - text: 'The <code>#box-2</code> element should have a <code>flex-basis</code> value of <code>20em</code>.' <del> testString: 'assert(code.match(/#box-2\s*?{\s*?.*?\s*?.*?\s*?flex-basis:\s*?20em;/g), ''The <code>#box-2</code> element should have a <code>flex-basis</code> value of <code>20em</code>.'');' <add> testString: 'assert(code.match(/#box-2\s*?{\s*?.*?\s*?.*?\s*?flex-basis:\s*?20em;/g), "The <code>#box-2</code> element should have a <code>flex-basis</code> value of <code>20em</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> display: flex; <ide> height: 500px; <ide> } <del> <add> <ide> #box-1 { <ide> background-color: dodgerblue; <ide> height: 200px; <del> <add> <ide> } <del> <add> <ide> #box-2 { <ide> background-color: orangered; <ide> height: 200px; <del> <add> <ide> } <ide> </style> <del> <add> <ide> <div id="box-container"> <ide> <div id="box-1"></div> <ide> <div id="box-2"></div> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-flexbox/use-the-flex-direction-property-to-make-a-column.english.md <ide> Add the CSS property <code>flex-direction</code> to the <code>#box-container</co <ide> ```yml <ide> tests: <ide> - text: 'The <code>#box-container</code> element should have a <code>flex-direction</code> property set to column.' <del> testString: 'assert($(''#box-container'').css(''flex-direction'') == ''column'', ''The <code>#box-container</code> element should have a <code>flex-direction</code> property set to column.'');' <add> testString: 'assert($("#box-container").css("flex-direction") == "column", "The <code>#box-container</code> element should have a <code>flex-direction</code> property set to column.");' <ide> <ide> ``` <ide> <ide> tests: <ide> #box-container { <ide> display: flex; <ide> height: 500px; <del> <add> <ide> } <ide> #box-1 { <ide> background-color: dodgerblue; <ide><path>curriculum/challenges/english/01-responsive-web-design/css-flexbox/use-the-flex-direction-property-to-make-a-row.english.md <ide> Add the CSS property <code>flex-direction</code> to the <code>#box-container</co <ide> ```yml <ide> tests: <ide> - text: 'The <code>#box-container</code> element should have a <code>flex-direction</code> property set to row-reverse.' <del> testString: 'assert($(''#box-container'').css(''flex-direction'') == ''row-reverse'', ''The <code>#box-container</code> element should have a <code>flex-direction</code> property set to row-reverse.'');' <add> testString: 'assert($("#box-container").css("flex-direction") == "row-reverse", "The <code>#box-container</code> element should have a <code>flex-direction</code> property set to row-reverse.");' <ide> <ide> ``` <ide> <ide> tests: <ide> #box-container { <ide> display: flex; <ide> height: 500px; <del> <add> <ide> } <ide> #box-1 { <ide> background-color: dodgerblue; <ide><path>curriculum/challenges/english/01-responsive-web-design/css-flexbox/use-the-flex-grow-property-to-expand-items.english.md <ide> Add the CSS property <code>flex-grow</code> to both <code>#box-1</code> and <cod <ide> ```yml <ide> tests: <ide> - text: 'The <code>#box-1</code> element should have the <code>flex-grow</code> property set to a value of 1.' <del> testString: 'assert($(''#box-1'').css(''flex-grow'') == ''1'', ''The <code>#box-1</code> element should have the <code>flex-grow</code> property set to a value of 1.'');' <add> testString: 'assert($("#box-1").css("flex-grow") == "1", "The <code>#box-1</code> element should have the <code>flex-grow</code> property set to a value of 1.");' <ide> - text: 'The <code>#box-2</code> element should have the <code>flex-grow</code> property set to a value of 2.' <del> testString: 'assert($(''#box-2'').css(''flex-grow'') == ''2'', ''The <code>#box-2</code> element should have the <code>flex-grow</code> property set to a value of 2.'');' <add> testString: 'assert($("#box-2").css("flex-grow") == "2", "The <code>#box-2</code> element should have the <code>flex-grow</code> property set to a value of 2.");' <ide> <ide> ``` <ide> <ide> tests: <ide> display: flex; <ide> height: 500px; <ide> } <del> <add> <ide> #box-1 { <ide> background-color: dodgerblue; <ide> height: 200px; <del> <add> <ide> } <del> <add> <ide> #box-2 { <ide> background-color: orangered; <ide> height: 200px; <del> <add> <ide> } <ide> </style> <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-flexbox/use-the-flex-shorthand-property.english.md <ide> These values will cause <code>#box-1</code> to grow to fill the extra space at t <ide> ```yml <ide> tests: <ide> - text: 'The <code>#box-1</code> element should have the <code>flex</code> property set to a value of 2 2 150px.' <del> testString: 'assert($(''#box-1'').css(''flex-grow'') == ''2'' && $(''#box-1'').css(''flex-shrink'') == ''2'' && $(''#box-1'').css(''flex-basis'') == ''150px'', ''The <code>#box-1</code> element should have the <code>flex</code> property set to a value of 2 2 150px.'');' <add> testString: 'assert($("#box-1").css("flex-grow") == "2" && $("#box-1").css("flex-shrink") == "2" && $("#box-1").css("flex-basis") == "150px", "The <code>#box-1</code> element should have the <code>flex</code> property set to a value of 2 2 150px.");' <ide> - text: 'The <code>#box-2</code> element should have the <code>flex</code> property set to a value of 1 1 150px.' <del> testString: 'assert($(''#box-2'').css(''flex-grow'') == ''1'' && $(''#box-2'').css(''flex-shrink'') == ''1'' && $(''#box-2'').css(''flex-basis'') == ''150px'', ''The <code>#box-2</code> element should have the <code>flex</code> property set to a value of 1 1 150px.'');' <add> testString: 'assert($("#box-2").css("flex-grow") == "1" && $("#box-2").css("flex-shrink") == "1" && $("#box-2").css("flex-basis") == "150px", "The <code>#box-2</code> element should have the <code>flex</code> property set to a value of 1 1 150px.");' <ide> - text: 'Your code should use the <code>flex</code> property for <code>#box-1</code> and <code>#box-2</code>.' <del> testString: 'assert(code.match(/flex:\s*?\d\s+?\d\s+?150px;/g).length == 2, ''Your code should use the <code>flex</code> property for <code>#box-1</code> and <code>#box-2</code>.'');' <add> testString: 'assert(code.match(/flex:\s*?\d\s+?\d\s+?150px;/g).length == 2, "Your code should use the <code>flex</code> property for <code>#box-1</code> and <code>#box-2</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> } <ide> #box-1 { <ide> background-color: dodgerblue; <del> <add> <ide> height: 200px; <ide> } <ide> <ide> #box-2 { <ide> background-color: orangered; <del> <add> <ide> height: 200px; <ide> } <ide> </style> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-flexbox/use-the-flex-shrink-property-to-shrink-items.english.md <ide> Add the CSS property <code>flex-shrink</code> to both <code>#box-1</code> and <c <ide> ```yml <ide> tests: <ide> - text: 'The <code>#box-1</code> element should have the <code>flex-shrink</code> property set to a value of 1.' <del> testString: 'assert($(''#box-1'').css(''flex-shrink'') == ''1'', ''The <code>#box-1</code> element should have the <code>flex-shrink</code> property set to a value of 1.'');' <add> testString: 'assert($("#box-1").css("flex-shrink") == "1", "The <code>#box-1</code> element should have the <code>flex-shrink</code> property set to a value of 1.");' <ide> - text: 'The <code>#box-2</code> element should have the <code>flex-shrink</code> property set to a value of 2.' <del> testString: 'assert($(''#box-2'').css(''flex-shrink'') == ''2'', ''The <code>#box-2</code> element should have the <code>flex-shrink</code> property set to a value of 2.'');' <add> testString: 'assert($("#box-2").css("flex-shrink") == "2", "The <code>#box-2</code> element should have the <code>flex-shrink</code> property set to a value of 2.");' <ide> <ide> ``` <ide> <ide> tests: <ide> background-color: dodgerblue; <ide> width: 100%; <ide> height: 200px; <del> <add> <ide> } <ide> <ide> #box-2 { <ide> background-color: orangered; <ide> width: 100%; <ide> height: 200px; <del> <add> <ide> } <ide> </style> <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-flexbox/use-the-flex-wrap-property-to-wrap-a-row-or-column.english.md <ide> The current layout has too many boxes for one row. Add the CSS property <code>fl <ide> ```yml <ide> tests: <ide> - text: 'The <code>#box-container</code> element should have the <code>flex-wrap</code> property set to a value of wrap.' <del> testString: 'assert($(''#box-container'').css(''flex-wrap'') == ''wrap'', ''The <code>#box-container</code> element should have the <code>flex-wrap</code> property set to a value of wrap.'');' <add> testString: 'assert($("#box-container").css("flex-wrap") == "wrap", "The <code>#box-container</code> element should have the <code>flex-wrap</code> property set to a value of wrap.");' <ide> <ide> ``` <ide> <ide> tests: <ide> background: gray; <ide> display: flex; <ide> height: 100%; <del> <add> <ide> } <ide> #box-1 { <ide> background-color: dodgerblue; <ide><path>curriculum/challenges/english/01-responsive-web-design/css-flexbox/use-the-justify-content-property-in-the-tweet-embed.english.md <ide> Add the CSS property <code>justify-content</code> to the header's <code>.profile <ide> ```yml <ide> tests: <ide> - text: 'The <code>.profile-name</code> element should have the <code>justify-content</code> property set to any of these values: center, flex-start, flex-end, space-between, or space-around.' <del> testString: 'assert(code.match(/header\s.profile-name\s*{\s*?.*?\s*?.*?\s*?\s*?.*?\s*?justify-content\s*:\s*(center|flex-start|flex-end|space-between|space-around)\s*;/g), ''The <code>.profile-name</code> element should have the <code>justify-content</code> property set to any of these values: center, flex-start, flex-end, space-between, or space-around.'');' <add> testString: 'assert(code.match(/header\s.profile-name\s*{\s*?.*?\s*?.*?\s*?\s*?.*?\s*?justify-content\s*:\s*(center|flex-start|flex-end|space-between|space-around)\s*;/g), "The <code>.profile-name</code> element should have the <code>justify-content</code> property set to any of these values: center, flex-start, flex-end, space-between, or space-around.");' <ide> <ide> ``` <ide> <ide> tests: <ide> header .profile-name { <ide> display: flex; <ide> flex-direction: column; <del> <add> <ide> margin-left: 10px; <ide> } <ide> header .follow-btn { <ide><path>curriculum/challenges/english/01-responsive-web-design/css-flexbox/use-the-order-property-to-rearrange-items.english.md <ide> Add the CSS property <code>order</code> to both <code>#box-1</code> and <code>#b <ide> ```yml <ide> tests: <ide> - text: 'The <code>#box-1</code> element should have the <code>order</code> property set to a value of 2.' <del> testString: 'assert($(''#box-1'').css(''order'') == ''2'', ''The <code>#box-1</code> element should have the <code>order</code> property set to a value of 2.'');' <add> testString: 'assert($("#box-1").css("order") == "2", "The <code>#box-1</code> element should have the <code>order</code> property set to a value of 2.");' <ide> - text: 'The <code>#box-2</code> element should have the <code>order</code> property set to a value of 1.' <del> testString: 'assert($(''#box-2'').css(''order'') == ''1'', ''The <code>#box-2</code> element should have the <code>order</code> property set to a value of 1.'');' <add> testString: 'assert($("#box-2").css("order") == "1", "The <code>#box-2</code> element should have the <code>order</code> property set to a value of 1.");' <ide> <ide> ``` <ide> <ide> tests: <ide> } <ide> #box-1 { <ide> background-color: dodgerblue; <del> <add> <ide> height: 200px; <ide> width: 200px; <ide> } <ide> <ide> #box-2 { <ide> background-color: orangered; <del> <add> <ide> height: 200px; <ide> width: 200px; <ide> } <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/add-columns-with-grid-template-columns.english.md <ide> Give the grid container three columns that are <code>100px</code> wide each. <ide> ```yml <ide> tests: <ide> - text: <code>container</code> class should have a <code>grid-template-columns</code> property with three units of <code>100px</code>. <del> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?100px\s*?100px\s*?100px\s*?;[\s\S]*}/gi), ''<code>container</code> class should have a <code>grid-template-columns</code> property with three units of <code>100px</code>.'');' <add> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?100px\s*?100px\s*?100px\s*?;[\s\S]*}/gi), "<code>container</code> class should have a <code>grid-template-columns</code> property with three units of <code>100px</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> .d3{background:PaleTurquoise;} <ide> .d4{background:LightPink;} <ide> .d5{background:PaleGreen;} <del> <add> <ide> .container { <ide> font-size: 40px; <ide> width: 100%; <ide> background: LightGray; <ide> display: grid; <ide> /* add your code below this line */ <del> <del> <add> <add> <ide> /* add your code above this line */ <ide> } <ide> </style> <del> <add> <ide> <div class="container"> <ide> <div class="d1">1</div> <ide> <div class="d2">2</div> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/add-gaps-faster-with-grid-gap.english.md <ide> Use <code>grid-gap</code> to introduce a <code>10px</code> gap between the rows <ide> ```yml <ide> tests: <ide> - text: <code>container</code> class should have a <code>grid-gap</code> property that introduces <code>10px</code> gap between the rows and <code>20px</code> gap between the columns. <del> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-gap\s*?:\s*?10px\s+?20px\s*?;[\s\S]*}/gi), ''<code>container</code> class should have a <code>grid-gap</code> property that introduces <code>10px</code> gap between the rows and <code>20px</code> gap between the columns.'');' <add> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-gap\s*?:\s*?10px\s+?20px\s*?;[\s\S]*}/gi), "<code>container</code> class should have a <code>grid-gap</code> property that introduces <code>10px</code> gap between the rows and <code>20px</code> gap between the columns.");' <ide> <ide> ``` <ide> <ide> tests: <ide> .d3{background:PaleTurquoise;} <ide> .d4{background:LightPink;} <ide> .d5{background:PaleGreen;} <del> <add> <ide> .container { <ide> font-size: 40px; <ide> min-height: 300px; <ide> tests: <ide> grid-template-columns: 1fr 1fr 1fr; <ide> grid-template-rows: 1fr 1fr 1fr; <ide> /* add your code below this line */ <del> <del> <add> <add> <ide> /* add your code above this line */ <ide> } <ide> </style> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/add-rows-with-grid-template-rows.english.md <ide> Add two rows to the grid that are <code>50px</code> tall each. <ide> ```yml <ide> tests: <ide> - text: <code>container</code> class should have a <code>grid-template-rows</code> property with two units of <code>50px</code>. <del> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-rows\s*?:\s*?50px\s*?50px\s*?;[\s\S]*}/gi), ''<code>container</code> class should have a <code>grid-template-rows</code> property with two units of <code>50px</code>.'');' <add> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-rows\s*?:\s*?50px\s*?50px\s*?;[\s\S]*}/gi), "<code>container</code> class should have a <code>grid-template-rows</code> property with two units of <code>50px</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> .d3{background:PaleTurquoise;} <ide> .d4{background:LightPink;} <ide> .d5{background:PaleGreen;} <del> <add> <ide> .container { <ide> font-size: 40px; <ide> width: 100%; <ide> background: LightGray; <ide> display: grid; <ide> grid-template-columns: 100px 100px 100px; <ide> /* add your code below this line */ <del> <del> <add> <add> <ide> /* add your code above this line */ <ide> } <ide> </style> <del> <add> <ide> <div class="container"> <ide> <div class="d1">1</div> <ide> <div class="d2">2</div> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/align-all-items-horizontally-using-justify-items.english.md <ide> Use this property to center all our items horizontally. <ide> ```yml <ide> tests: <ide> - text: <code>container</code> class should have a <code>justify-items</code> property that has the value of <code>center</code>. <del> testString: 'assert(code.match(/.container\s*?{[\s\S]*justify-items\s*?:\s*?center\s*?;[\s\S]*}/gi), ''<code>container</code> class should have a <code>justify-items</code> property that has the value of <code>center</code>.'');' <add> testString: 'assert(code.match(/.container\s*?{[\s\S]*justify-items\s*?:\s*?center\s*?;[\s\S]*}/gi), "<code>container</code> class should have a <code>justify-items</code> property that has the value of <code>center</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> .item3{background:PaleTurquoise;} <ide> .item4{background:LightPink;} <ide> .item5{background:PaleGreen;} <del> <add> <ide> .container { <ide> font-size: 40px; <ide> min-height: 300px; <ide> tests: <ide> grid-template-rows: 1fr 1fr 1fr; <ide> grid-gap: 10px; <ide> /* add your code below this line */ <del> <del> <add> <add> <ide> /* add your code above this line */ <ide> } <ide> </style> <del> <add> <ide> <div class="container"> <ide> <div class="item1">1</div> <ide> <div class="item2">2</div> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/align-all-items-vertically-using-align-items.english.md <ide> Use it now to move all the items to the end of each cell. <ide> ```yml <ide> tests: <ide> - text: <code>container</code> class should have a <code>align-items</code> property that has the value of <code>end</code>. <del> testString: 'assert(code.match(/.container\s*?{[\s\S]*align-items\s*?:\s*?end\s*?;[\s\S]*}/gi), ''<code>container</code> class should have a <code>align-items</code> property that has the value of <code>end</code>.'');' <add> testString: 'assert(code.match(/.container\s*?{[\s\S]*align-items\s*?:\s*?end\s*?;[\s\S]*}/gi), "<code>container</code> class should have a <code>align-items</code> property that has the value of <code>end</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> .item3{background:PaleTurquoise;} <ide> .item4{background:LightPink;} <ide> .item5{background:PaleGreen;} <del> <add> <ide> .container { <ide> font-size: 40px; <ide> min-height: 300px; <ide> tests: <ide> grid-template-rows: 1fr 1fr 1fr; <ide> grid-gap: 10px; <ide> /* add your code below this line */ <del> <del> <add> <add> <ide> /* add your code above this line */ <ide> } <ide> </style> <del> <add> <ide> <div class="container"> <ide> <div class="item1">1</div> <ide> <div class="item2">2</div> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/align-an-item-horizontally-using-justify-self.english.md <ide> Use the <code>justify-self</code> property to center the item with the class <co <ide> ```yml <ide> tests: <ide> - text: <code>item2</code> class should have a <code>justify-self</code> property that has the value of <code>center</code>. <del> testString: 'assert(code.match(/.item2\s*?{[\s\S]*justify-self\s*?:\s*?center\s*?;[\s\S]*}/gi), ''<code>item2</code> class should have a <code>justify-self</code> property that has the value of <code>center</code>.'');' <add> testString: 'assert(code.match(/.item2\s*?{[\s\S]*justify-self\s*?:\s*?center\s*?;[\s\S]*}/gi), "<code>item2</code> class should have a <code>justify-self</code> property that has the value of <code>center</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```html <ide> <style> <ide> .item1{background: LightSkyBlue;} <del> <add> <ide> .item2 { <ide> background: LightSalmon; <ide> /* add your code below this line */ <del> <del> <add> <add> <ide> /* add your code above this line */ <ide> } <del> <add> <ide> .item3{background:PaleTurquoise;} <ide> .item4{background:LightPink;} <ide> .item5{background:PaleGreen;} <del> <add> <ide> .container { <ide> font-size: 40px; <ide> min-height: 300px; <ide> tests: <ide> grid-gap: 10px; <ide> } <ide> </style> <del> <add> <ide> <div class="container"> <ide> <div class="item1">1</div> <ide> <div class="item2">2</div> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/align-an-item-vertically-using-align-self.english.md <ide> Align the item with the class <code>item3</code> vertically at the <code>end</co <ide> ```yml <ide> tests: <ide> - text: <code>item3</code> class should have a <code>align-self</code> property that has the value of <code>end</code>. <del> testString: 'assert(code.match(/.item3\s*?{[\s\S]*align-self\s*?:\s*?end\s*?;[\s\S]*}/gi), ''<code>item3</code> class should have a <code>align-self</code> property that has the value of <code>end</code>.'');' <add> testString: 'assert(code.match(/.item3\s*?{[\s\S]*align-self\s*?:\s*?end\s*?;[\s\S]*}/gi), "<code>item3</code> class should have a <code>align-self</code> property that has the value of <code>end</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <style> <ide> .item1{background:LightSkyBlue;} <ide> .item2{background:LightSalmon;} <del> <add> <ide> .item3 { <ide> background: PaleTurquoise; <ide> /* add your code below this line */ <del> <del> <add> <add> <ide> /* add your code above this line */ <ide> } <del> <add> <ide> .item4{background:LightPink;} <ide> .item5{background:PaleGreen;} <del> <add> <ide> .container { <ide> font-size: 40px; <ide> min-height: 300px; <ide> tests: <ide> grid-gap: 10px; <ide> } <ide> </style> <del> <add> <ide> <div class="container"> <ide> <div class="item1">1</div> <ide> <div class="item2">2</div> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/create-a-column-gap-using-grid-column-gap.english.md <ide> Give the columns in the grid a <code>20px</code> gap. <ide> ```yml <ide> tests: <ide> - text: <code>container</code> class should have a <code>grid-column-gap</code> property that has the value of <code>20px</code>. <del> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-column-gap\s*?:\s*?20px\s*?;[\s\S]*}/gi), ''<code>container</code> class should have a <code>grid-column-gap</code> property that has the value of <code>20px</code>.'');' <add> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-column-gap\s*?:\s*?20px\s*?;[\s\S]*}/gi), "<code>container</code> class should have a <code>grid-column-gap</code> property that has the value of <code>20px</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> .d3{background:PaleTurquoise;} <ide> .d4{background:LightPink;} <ide> .d5{background:PaleGreen;} <del> <add> <ide> .container { <ide> font-size: 40px; <ide> min-height: 300px; <ide> tests: <ide> grid-template-columns: 1fr 1fr 1fr; <ide> grid-template-rows: 1fr 1fr 1fr; <ide> /* add your code below this line */ <del> <del> <add> <add> <ide> /* add your code above this line */ <ide> } <ide> </style> <del> <add> <ide> <div class="container"> <ide> <div class="d1">1</div> <ide> <div class="d2">2</div> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/create-a-row-gap-using-grid-row-gap.english.md <ide> Create a gap for the rows that is <code>5px</code> tall. <ide> ```yml <ide> tests: <ide> - text: <code>container</code> class should have a <code>grid-row-gap</code> property that has the value of <code>5px</code>. <del> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-row-gap\s*?:\s*?5px\s*?;[\s\S]*}/gi), ''<code>container</code> class should have a <code>grid-row-gap</code> property that has the value of <code>5px</code>.'');' <add> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-row-gap\s*?:\s*?5px\s*?;[\s\S]*}/gi), "<code>container</code> class should have a <code>grid-row-gap</code> property that has the value of <code>5px</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> .d3{background:PaleTurquoise;} <ide> .d4{background:LightPink;} <ide> .d5{background:PaleGreen;} <del> <add> <ide> .container { <ide> font-size: 40px; <ide> min-height: 300px; <ide> tests: <ide> grid-template-columns: 1fr 1fr 1fr; <ide> grid-template-rows: 1fr 1fr 1fr; <ide> /* add your code below this line */ <del> <del> <add> <add> <ide> /* add your code above this line */ <ide> } <ide> </style> <del> <add> <ide> <div class="container"> <ide> <div class="d1">1</div> <ide> <div class="d2">2</div> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/create-flexible-layouts-using-auto-fill.english.md <ide> In the first grid, use <code>auto-fill</code> with <code>repeat</code> to fill t <ide> ```yml <ide> tests: <ide> - text: <code>container</code> class should have a <code>grid-template-columns</code> property with <code>repeat</code> and <code>auto-fill</code> that will fill the grid with columns that have a minimum width of <code>60px</code> and maximum of <code>1fr</code>. <del> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?auto-fill\s*?,\s*?minmax\s*?\(\s*?60px\s*?,\s*?1fr\s*?\)\s*?\)\s*?;[\s\S]*}/gi), ''<code>container</code> class should have a <code>grid-template-columns</code> property with <code>repeat</code> and <code>auto-fill</code> that will fill the grid with columns that have a minimum width of <code>60px</code> and maximum of <code>1fr</code>.'');' <add> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?auto-fill\s*?,\s*?minmax\s*?\(\s*?60px\s*?,\s*?1fr\s*?\)\s*?\)\s*?;[\s\S]*}/gi), "<code>container</code> class should have a <code>grid-template-columns</code> property with <code>repeat</code> and <code>auto-fill</code> that will fill the grid with columns that have a minimum width of <code>60px</code> and maximum of <code>1fr</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> .item3{background:PaleTurquoise;} <ide> .item4{background:LightPink;} <ide> .item5{background:PaleGreen;} <del> <add> <ide> .container { <ide> font-size: 40px; <ide> min-height: 100px; <ide> width: 100%; <ide> background: LightGray; <ide> display: grid; <ide> /* change the code below this line */ <del> <add> <ide> grid-template-columns: repeat(3, minmax(60px, 1fr)); <del> <add> <ide> /* change the code above this line */ <ide> grid-template-rows: 1fr 1fr 1fr; <ide> grid-gap: 10px; <ide> } <del> <add> <ide> .container2 { <ide> font-size: 40px; <ide> min-height: 100px; <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/create-flexible-layouts-using-auto-fit.english.md <ide> In the second grid, use <code>auto-fit</code> with <code>repeat</code> to fill t <ide> ```yml <ide> tests: <ide> - text: <code>container2</code> class should have a <code>grid-template-columns</code> property with <code>repeat</code> and <code>auto-fit</code> that will fill the grid with columns that have a minimum width of <code>60px</code> and maximum of <code>1fr</code>. <del> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?auto-fit\s*?,\s*?minmax\s*?\(\s*?60px\s*?,\s*?1fr\s*?\)\s*?\)\s*?;[\s\S]*}/gi), ''<code>container2</code> class should have a <code>grid-template-columns</code> property with <code>repeat</code> and <code>auto-fit</code> that will fill the grid with columns that have a minimum width of <code>60px</code> and maximum of <code>1fr</code>.'');' <add> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?auto-fit\s*?,\s*?minmax\s*?\(\s*?60px\s*?,\s*?1fr\s*?\)\s*?\)\s*?;[\s\S]*}/gi), "<code>container2</code> class should have a <code>grid-template-columns</code> property with <code>repeat</code> and <code>auto-fit</code> that will fill the grid with columns that have a minimum width of <code>60px</code> and maximum of <code>1fr</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> .item3{background:PaleTurquoise;} <ide> .item4{background:LightPink;} <ide> .item5{background:PaleGreen;} <del> <add> <ide> .container { <ide> font-size: 40px; <ide> min-height: 100px; <ide> tests: <ide> grid-template-rows: 1fr 1fr 1fr; <ide> grid-gap: 10px; <ide> } <del> <add> <ide> .container2 { <ide> font-size: 40px; <ide> min-height: 100px; <ide> width: 100%; <ide> background: Silver; <ide> display: grid; <ide> /* change the code below this line */ <del> <add> <ide> grid-template-columns: repeat(3, minmax(60px, 1fr)); <del> <add> <ide> /* change the code above this line */ <ide> grid-template-rows: 1fr 1fr 1fr; <ide> grid-gap: 10px; <ide> } <ide> </style> <del> <add> <ide> <div class="container"> <ide> <div class="item1">1</div> <ide> <div class="item2">2</div> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/create-grids-within-grids.english.md <ide> Turn the element with the <code>item3</code> class into a grid with two columns <ide> ```yml <ide> tests: <ide> - text: <code>item3</code> class should have a <code>grid-template-columns</code> property with <code>auto</code> and <code>1fr</code> as values. <del> testString: 'assert(code.match(/.item3\s*?{[\s\S]*grid-template-columns\s*?:\s*?auto\s*?1fr\s*?;[\s\S]*}/gi), ''<code>item3</code> class should have a <code>grid-template-columns</code> property with <code>auto</code> and <code>1fr</code> as values.'');' <add> testString: 'assert(code.match(/.item3\s*?{[\s\S]*grid-template-columns\s*?:\s*?auto\s*?1fr\s*?;[\s\S]*}/gi), "<code>item3</code> class should have a <code>grid-template-columns</code> property with <code>auto</code> and <code>1fr</code> as values.");' <ide> - text: <code>item3</code> class should have a <code>display</code> property with the value of <code>grid</code>. <del> testString: 'assert(code.match(/.item3\s*?{[\s\S]*display\s*?:\s*?grid\s*?;[\s\S]*}/gi), ''<code>item3</code> class should have a <code>display</code> property with the value of <code>grid</code>.'');' <add> testString: 'assert(code.match(/.item3\s*?{[\s\S]*display\s*?:\s*?grid\s*?;[\s\S]*}/gi), "<code>item3</code> class should have a <code>display</code> property with the value of <code>grid</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> background: LightSkyBlue; <ide> grid-area: header; <ide> } <del> <add> <ide> .item2 { <ide> background: LightSalmon; <ide> grid-area: advert; <ide> } <del> <add> <ide> .item3 { <ide> background: PaleTurquoise; <ide> grid-area: content; <ide> /* enter your code below this line */ <del> <del> <add> <add> <ide> /* enter your code above this line */ <ide> } <del> <add> <ide> .item4 { <ide> background: lightpink; <ide> grid-area: footer; <ide> } <del> <add> <ide> .itemOne { <ide> background: PaleGreen; <ide> } <del> <add> <ide> .itemTwo { <ide> background: BlanchedAlmond; <ide> } <del> <add> <ide> </style> <del> <add> <ide> <div class="container"> <ide> <div class="item1">header</div> <ide> <div class="item2">advert</div> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/create-your-first-css-grid.english.md <ide> Change the display of the div with the <code>container</code> class to <code>gri <ide> ```yml <ide> tests: <ide> - text: <code>container</code> class should have a <code>display</code> property with a value of <code>grid</code>. <del> testString: 'assert(code.match(/.container\s*?{[\s\S]*display\s*?:\s*?grid\s*?;[\s\S]*}/gi), ''<code>container</code> class should have a <code>display</code> property with a value of <code>grid</code>.'');' <add> testString: 'assert(code.match(/.container\s*?{[\s\S]*display\s*?:\s*?grid\s*?;[\s\S]*}/gi), "<code>container</code> class should have a <code>display</code> property with a value of <code>grid</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> .d3{background:PaleTurquoise;} <ide> .d4{background:LightPink;} <ide> .d5{background:PaleGreen;} <del> <add> <ide> .container { <ide> font-size: 40px; <ide> width: 100%; <ide> background: LightGray; <ide> /* add your code below this line */ <del> <del> <add> <add> <ide> /* add your code above this line */ <ide> } <ide> </style> <del> <add> <ide> <div class="container"> <ide> <div class="d1">1</div> <ide> <div class="d2">2</div> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/divide-the-grid-into-an-area-template.english.md <ide> Place the area template so that the cell labeled <code>advert</code> becomes an <ide> ```yml <ide> tests: <ide> - text: <code>container</code> class should have a <code>grid-template-areas</code> property similar to the preview but has <code>.</code> instead of the <code>advert</code> area. <del> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-areas\s*?:\s*?"\s*?header\s*?header\s*?header\s*?"\s*?"\s*?.\s*?content\s*?content\s*?"\s*?"\s*?footer\s*?footer\s*?footer\s*?"\s*?;[\s\S]*}/gi), ''<code>container</code> class should have a <code>grid-template-areas</code> propertiy similar to the preview but has <code>.</code> instead of the <code>advert</code> area.'');' <add> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-areas\s*?:\s*?"\s*?header\s*?header\s*?header\s*?"\s*?"\s*?.\s*?content\s*?content\s*?"\s*?"\s*?footer\s*?footer\s*?footer\s*?"\s*?;[\s\S]*}/gi), "<code>container</code> class should have a <code>grid-template-areas</code> propertiy similar to the preview but has <code>.</code> instead of the <code>advert</code> area.");' <ide> <ide> ``` <ide> <ide> tests: <ide> .item3{background:PaleTurquoise;} <ide> .item4{background:LightPink;} <ide> .item5{background:PaleGreen;} <del> <add> <ide> .container { <ide> font-size: 40px; <ide> min-height: 300px; <ide> tests: <ide> grid-template-rows: 1fr 1fr 1fr; <ide> grid-gap: 10px; <ide> /* change code below this line */ <del> <add> <ide> grid-template-areas: <ide> "header header header" <ide> "advert content content" <ide> "footer footer footer"; <ide> /* change code above this line */ <ide> } <ide> </style> <del> <add> <ide> <div class="container"> <ide> <div class="item1">1</div> <ide> <div class="item2">2</div> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/limit-item-size-using-the-minmax-function.english.md <ide> Using the <code>minmax</code> function, replace the <code>1fr</code> in the <cod <ide> ```yml <ide> tests: <ide> - text: <code>container</code> class should have a <code>grid-template-columns</code> property that is set to repeat 3 columns with the minimum width of <code>90px</code> and maximum width of <code>1fr</code>. <del> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?3\s*?,\s*?minmax\s*?\(\s*?90px\s*?,\s*?1fr\s*?\)\s*?\)\s*?;[\s\S]*}/gi), ''<code>container</code> class should have a <code>grid-template-columns</code> property that is set to repeat 3 columns with the minimum width of <code>90px</code> and maximum width of <code>1fr</code>.'');' <add> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?3\s*?,\s*?minmax\s*?\(\s*?90px\s*?,\s*?1fr\s*?\)\s*?\)\s*?;[\s\S]*}/gi), "<code>container</code> class should have a <code>grid-template-columns</code> property that is set to repeat 3 columns with the minimum width of <code>90px</code> and maximum width of <code>1fr</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> .item3{background:PaleTurquoise;} <ide> .item4{background:LightPink;} <ide> .item5{background:PaleGreen;} <del> <add> <ide> .container { <ide> font-size: 40px; <ide> min-height: 300px; <ide> width: 100%; <ide> background: LightGray; <ide> display: grid; <ide> /* change the code below this line */ <del> <add> <ide> grid-template-columns: repeat(3, 1fr); <del> <add> <ide> /* change the code above this line */ <ide> grid-template-rows: 1fr 1fr 1fr; <ide> grid-gap: 10px; <ide> } <ide> </style> <del> <add> <ide> <div class="container"> <ide> <div class="item1">1</div> <ide> <div class="item2">2</div> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/place-items-in-grid-areas-using-the-grid-area-property.english.md <ide> Place an element with the <code>item5</code> class in the <code>footer</code> ar <ide> ```yml <ide> tests: <ide> - text: <code>item5</code> class should have a <code>grid-area</code> property that has the value of <code>footer</code>. <del> testString: 'assert(code.match(/.item5\s*?{[\s\S]*grid-area\s*?:\s*?footer\s*?;[\s\S]*}/gi), ''<code>item5</code> class should have a <code>grid-area</code> property that has the value of <code>footer</code>.'');' <add> testString: 'assert(code.match(/.item5\s*?{[\s\S]*grid-area\s*?:\s*?footer\s*?;[\s\S]*}/gi), "<code>item5</code> class should have a <code>grid-area</code> property that has the value of <code>footer</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> .item2{background:LightSalmon;} <ide> .item3{background:PaleTurquoise;} <ide> .item4{background:LightPink;} <del> <add> <ide> .item5 { <ide> background: PaleGreen; <ide> /* add your code below this line */ <del> <del> <add> <add> <ide> /* add your code above this line */ <ide> } <del> <add> <ide> .container { <ide> font-size: 40px; <ide> min-height: 300px; <ide> tests: <ide> grid-template-columns: 1fr 1fr 1fr; <ide> grid-template-rows: 1fr 1fr 1fr; <ide> grid-gap: 10px; <del> grid-template-areas: <add> grid-template-areas: <ide> "header header header" <ide> "advert content content" <ide> "footer footer footer"; <ide> } <ide> </style> <del> <add> <ide> <div class="container"> <ide> <div class="item1">1</div> <ide> <div class="item2">2</div> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/reduce-repetition-using-the-repeat-function.english.md <ide> Use <code>repeat</code> to remove repetition from the <code>grid-template-column <ide> ```yml <ide> tests: <ide> - text: <code>container</code> class should have a <code>grid-template-columns</code> property that is set to repeat 3 columns with the width of <code>1fr</code>. <del> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?3\s*?,\s*?1fr\s*?\)\s*?;[\s\S]*}/gi), ''<code>container</code> class should have a <code>grid-template-columns</code> property that is set to repeat 3 columns with the width of <code>1fr</code>.'');' <add> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?3\s*?,\s*?1fr\s*?\)\s*?;[\s\S]*}/gi), "<code>container</code> class should have a <code>grid-template-columns</code> property that is set to repeat 3 columns with the width of <code>1fr</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> .item3{background:PaleTurquoise;} <ide> .item4{background:LightPink;} <ide> .item5{background:PaleGreen;} <del> <add> <ide> .container { <ide> font-size: 40px; <ide> min-height: 300px; <ide> width: 100%; <ide> background: LightGray; <ide> display: grid; <ide> /* change the code below this line */ <del> <add> <ide> grid-template-columns: 1fr 1fr 1fr; <del> <add> <ide> /* change the code above this line */ <ide> grid-template-rows: 1fr 1fr 1fr; <ide> grid-gap: 10px; <ide> } <ide> </style> <del> <add> <ide> <div class="container"> <ide> <div class="item1">1</div> <ide> <div class="item2">2</div> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/use-css-grid-units-to-change-the-size-of-columns-and-rows.english.md <ide> Make a grid with three columns whose widths are as follows: 1fr, 100px, and 2fr. <ide> ```yml <ide> tests: <ide> - text: '<code>container</code> class should have a <code>grid-template-columns</code> property that has three columns with the following widths: <code>1fr, 100px, and 2fr</code>.' <del> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?1fr\s*?100px\s*?2fr\s*?;[\s\S]*}/gi), ''<code>container</code> class should have a <code>grid-template-columns</code> property that has three columns with the following widths: <code>1fr, 100px, and 2fr</code>.'');' <add> testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?1fr\s*?100px\s*?2fr\s*?;[\s\S]*}/gi), "<code>container</code> class should have a <code>grid-template-columns</code> property that has three columns with the following widths: <code>1fr, 100px, and 2fr</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> .d3{background:PaleTurquoise;} <ide> .d4{background:LightPink;} <ide> .d5{background:PaleGreen;} <del> <add> <ide> .container { <ide> font-size: 40px; <ide> width: 100%; <ide> background: LightGray; <ide> display: grid; <ide> /* modify the code below this line */ <del> <add> <ide> grid-template-columns: auto 50px 10% 2fr 1fr; <del> <add> <ide> /* modify the code above this line */ <ide> grid-template-rows: 50px 50px; <ide> } <ide> </style> <del> <add> <ide> <div class="container"> <ide> <div class="d1">1</div> <ide> <div class="d2">2</div> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/use-grid-area-without-creating-an-areas-template.english.md <ide> Using the <code>grid-area</code> property, place the element with <code>item5</c <ide> ```yml <ide> tests: <ide> - text: <code>item5</code> class should have a <code>grid-area</code> property that has the value of <code>3/1/4/4</code>. <del> testString: 'assert(code.match(/.item5\s*?{[\s\S]*grid-area\s*?:\s*?3\s*?\/\s*?1\s*?\/\s*?4\s*?\/\s*?4\s*?;[\s\S]*}/gi), ''<code>item5</code> class should have a <code>grid-area</code> property that has the value of <code>3/1/4/4</code>.'');' <add> testString: 'assert(code.match(/.item5\s*?{[\s\S]*grid-area\s*?:\s*?3\s*?\/\s*?1\s*?\/\s*?4\s*?\/\s*?4\s*?;[\s\S]*}/gi), "<code>item5</code> class should have a <code>grid-area</code> property that has the value of <code>3/1/4/4</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> .item2{background:LightSalmon;} <ide> .item3{background:PaleTurquoise;} <ide> .item4{background:LightPink;} <del> <add> <ide> .item5 { <ide> background: PaleGreen; <ide> /* add your code below this line */ <del> <del> <add> <add> <ide> /* add your code above this line */ <ide> } <del> <add> <ide> .container { <ide> font-size: 40px; <ide> min-height: 300px; <ide> tests: <ide> grid-gap: 10px; <ide> } <ide> </style> <del> <add> <ide> <div class="container"> <ide> <div class="item1">1</div> <ide> <div class="item2">2</div> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/use-grid-column-to-control-spacing.english.md <ide> Make the item with the class <code>item5</code> consume the last two columns of <ide> ```yml <ide> tests: <ide> - text: <code>item5</code> class should have a <code>grid-column</code> property that has the value of <code>2 / 4</code>. <del> testString: 'assert(code.match(/.item5\s*?{[\s\S]*grid-column\s*?:\s*?2\s*?\/\s*?4\s*?;[\s\S]*}/gi), ''<code>item5</code> class should have a <code>grid-column</code> property that has the value of <code>2 / 4</code>.'');' <add> testString: 'assert(code.match(/.item5\s*?{[\s\S]*grid-column\s*?:\s*?2\s*?\/\s*?4\s*?;[\s\S]*}/gi), "<code>item5</code> class should have a <code>grid-column</code> property that has the value of <code>2 / 4</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> .item2{background:LightSalmon;} <ide> .item3{background:PaleTurquoise;} <ide> .item4{background:LightPink;} <del> <add> <ide> .item5 { <ide> background: PaleGreen; <ide> /* add your code below this line */ <del> <del> <add> <add> <ide> /* add your code above this line */ <ide> } <del> <add> <ide> .container { <ide> font-size: 40px; <ide> min-height: 300px; <ide> tests: <ide> grid-gap: 10px; <ide> } <ide> </style> <del> <add> <ide> <div class="container"> <ide> <div class="item1">1</div> <ide> <div class="item2">2</div> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/use-grid-row-to-control-spacing.english.md <ide> Make the element with the <code>item5</code> class consume the last two rows. <ide> ```yml <ide> tests: <ide> - text: <code>item5</code> class should have a <code>grid-row</code> property that has the value of <code>2 / 4</code>. <del> testString: 'assert(code.match(/.item5\s*?{[\s\S]*grid-row\s*?:\s*?2\s*?\/\s*?4\s*?;[\s\S]*}/gi), ''<code>item5</code> class should have a <code>grid-row</code> property that has the value of <code>2 / 4</code>.'');' <add> testString: 'assert(code.match(/.item5\s*?{[\s\S]*grid-row\s*?:\s*?2\s*?\/\s*?4\s*?;[\s\S]*}/gi), "<code>item5</code> class should have a <code>grid-row</code> property that has the value of <code>2 / 4</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> .item2{background:LightSalmon;} <ide> .item3{background:PaleTurquoise;} <ide> .item4{background:LightPink;} <del> <add> <ide> .item5 { <ide> background: PaleGreen; <ide> grid-column: 2 / 4; <ide> /* add your code below this line */ <del> <del> <add> <add> <ide> /* add your code above this line */ <ide> } <del> <add> <ide> .container { <ide> font-size: 40px; <ide> min-height: 300px; <ide> tests: <ide> grid-gap: 10px; <ide> } <ide> </style> <del> <add> <ide> <div class="container"> <ide> <div class="item1">1</div> <ide> <div class="item2">2</div> <ide><path>curriculum/challenges/english/01-responsive-web-design/css-grid/use-media-queries-to-create-responsive-layouts.english.md <ide> When the viewport width is <code>400px</code> or more, make the header area occu <ide> ```yml <ide> tests: <ide> - text: 'When the viewport is <code>400px</code> or more, <code>container</code> class should have a <code>grid-template-areas</code> property in which the footer and header areas occupy the top and bottom rows respectively and advert and content occupy the left and right columns of the middle row.' <del> testString: 'assert(code.match(/@media\s*?\(\s*?min-width\s*?:\s*?400px\s*?\)[\s\S]*.container\s*?{[\s\S]*grid-template-areas\s*?:\s*?"\s*?header\s*?header\s*?"\s*?"\s*?advert\s*?content\s*?"\s*?"\s*?footer\s*?footer\s*?"\s*?;[\s\S]*}/gi), ''When the viewport is <code>400px</code> or more, <code>container</code> class should have a <code>grid-template-areas</code> property in which the footer and header areas occupy the top and bottom rows respectively and advert and content occupy the left and right columns of the middle row.'');' <add> testString: 'assert(code.match(/@media\s*?\(\s*?min-width\s*?:\s*?400px\s*?\)[\s\S]*.container\s*?{[\s\S]*grid-template-areas\s*?:\s*?"\s*?header\s*?header\s*?"\s*?"\s*?advert\s*?content\s*?"\s*?"\s*?footer\s*?footer\s*?"\s*?;[\s\S]*}/gi), "When the viewport is <code>400px</code> or more, <code>container</code> class should have a <code>grid-template-areas</code> property in which the footer and header areas occupy the top and bottom rows respectively and advert and content occupy the left and right columns of the middle row.");' <ide> <ide> ``` <ide> <ide> tests: <ide> background: LightSkyBlue; <ide> grid-area: header; <ide> } <del> <add> <ide> .item2 { <ide> background: LightSalmon; <ide> grid-area: advert; <ide> } <del> <add> <ide> .item3 { <ide> background: PaleTurquoise; <ide> grid-area: content; <ide> } <del> <add> <ide> .item4 { <ide> background: lightpink; <ide> grid-area: footer; <ide> } <del> <add> <ide> .container { <ide> font-size: 1.5em; <ide> min-height: 300px; <ide> tests: <ide> "content" <ide> "footer"; <ide> } <del> <add> <ide> @media (min-width: 300px){ <ide> .container{ <ide> grid-template-columns: auto 1fr; <ide> tests: <ide> "advert footer"; <ide> } <ide> } <del> <add> <ide> @media (min-width: 400px){ <ide> .container{ <ide> /* change the code below this line */ <del> <add> <ide> grid-template-areas: <ide> "advert header" <ide> "advert content" <ide> "advert footer"; <del> <add> <ide> /* change the code above this line */ <ide> } <ide> } <ide> </style> <del> <add> <ide> <div class="container"> <ide> <div class="item1">header</div> <ide> <div class="item2">advert</div> <ide><path>curriculum/challenges/english/01-responsive-web-design/responsive-web-design-principles/create-a-media-query.english.md <ide> Add a media query, so that the <code>p</code> tag has a <code>font-size</code> o <ide> ```yml <ide> tests: <ide> - text: Your <code>p</code> element should have the <code>font-size</code> of 10px when the device <code>height</code> is less than or equal to 800px. <del> testString: 'assert($(''p'').css(''font-size'') == ''10px'', ''Your <code>p</code> element should have the <code>font-size</code> of 10px when the device <code>height</code> is less than or equal to 800px.'');' <add> testString: 'assert($("p").css("font-size") == "10px", "Your <code>p</code> element should have the <code>font-size</code> of 10px when the device <code>height</code> is less than or equal to 800px.");' <ide> - text: Declare a <code>@media</code> query for devices with a <code>height</code> less than or equal to 800px. <del> testString: 'assert(code.match(/@media\s*?\(\s*?max-height\s*?:\s*?800px\s*?\)/g), ''Declare a <code>@media</code> query for devices with a <code>height</code> less than or equal to 800px.'');' <add> testString: 'assert(code.match(/@media\s*?\(\s*?max-height\s*?:\s*?800px\s*?\)/g), "Declare a <code>@media</code> query for devices with a <code>height</code> less than or equal to 800px.");' <ide> <ide> ``` <ide> <ide> tests: <ide> p { <ide> font-size: 20px; <ide> } <del> <add> <ide> /* Add media query below */ <del> <add> <ide> </style> <del> <add> <ide> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus quis tempus massa. Aenean erat nisl, gravida vel vestibulum cursus, interdum sit amet lectus. Sed sit amet quam nibh. Suspendisse quis tincidunt nulla. In hac habitasse platea dictumst. Ut sit amet pretium nisl. Vivamus vel mi sem. Aenean sit amet consectetur sem. Suspendisse pretium, purus et gravida consequat, nunc ligula ultricies diam, at aliquet velit libero a dui.</p> <ide> ``` <ide> <ide><path>curriculum/challenges/english/01-responsive-web-design/responsive-web-design-principles/make-an-image-responsive.english.md <ide> Add style rules for the <code>img</code> tag to make it responsive to the size o <ide> ```yml <ide> tests: <ide> - text: Your <code>img</code> tag should have a <code>max-width</code> set to 100%. <del> testString: 'assert(code.match(/max-width:\s*?100%;/g), ''Your <code>img</code> tag should have a <code>max-width</code> set to 100%.'');' <add> testString: 'assert(code.match(/max-width:\s*?100%;/g), "Your <code>img</code> tag should have a <code>max-width</code> set to 100%.");' <ide> - text: Your <code>img</code> tag should have a <code>display</code> set to block. <del> testString: 'assert($(''img'').css(''display'') == ''block'', ''Your <code>img</code> tag should have a <code>display</code> set to block.'');' <add> testString: 'assert($("img").css("display") == "block", "Your <code>img</code> tag should have a <code>display</code> set to block.");' <ide> - text: Your <code>img</code> tag should have a <code>height</code> set to auto. <del> testString: 'assert(code.match(/height:\s*?auto;/g), ''Your <code>img</code> tag should have a <code>height</code> set to auto.'');' <add> testString: 'assert(code.match(/height:\s*?auto;/g), "Your <code>img</code> tag should have a <code>height</code> set to auto.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <ide> ```html <ide> <style> <del> <add> <ide> </style> <ide> <ide> <img src="https://s3.amazonaws.com/freecodecamp/FCCStickerPack.jpg" alt="freeCodeCamp stickers set"> <ide><path>curriculum/challenges/english/01-responsive-web-design/responsive-web-design-principles/make-typography-responsive.english.md <ide> Set the <code>width</code> of the <code>h2</code> tag to 80% of the viewport's w <ide> ```yml <ide> tests: <ide> - text: Your <code>h2</code> tag should have a <code>width</code> of 80vw. <del> testString: 'assert(code.match(/h2\s*?{\s*?width:\s*?80vw;\s*?}/g), ''Your <code>h2</code> tag should have a <code>width</code> of 80vw.'');' <add> testString: 'assert(code.match(/h2\s*?{\s*?width:\s*?80vw;\s*?}/g), "Your <code>h2</code> tag should have a <code>width</code> of 80vw.");' <ide> - text: Your <code>p</code> tag should have a <code>width</code> of 75vmin. <del> testString: 'assert(code.match(/p\s*?{\s*?width:\s*?75vmin;\s*?}/g), ''Your <code>p</code> tag should have a <code>width</code> of 75vmin.'');' <add> testString: 'assert(code.match(/p\s*?{\s*?width:\s*?75vmin;\s*?}/g), "Your <code>p</code> tag should have a <code>width</code> of 75vmin.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <ide> ```html <ide> <style> <del> <add> <ide> </style> <ide> <ide> <h2>Importantus Ipsum</h2> <ide><path>curriculum/challenges/english/01-responsive-web-design/responsive-web-design-principles/use-a-retina-image-for-higher-resolution-displays.english.md <ide> Set the <code>width</code> and <code>height</code> of the <code>img</code> tag t <ide> ```yml <ide> tests: <ide> - text: Your <code>img</code> tag should have a <code>width</code> of 100 pixels. <del> testString: 'assert($(''img'').css(''width'') == ''100px'', ''Your <code>img</code> tag should have a <code>width</code> of 100 pixels.'');' <add> testString: 'assert($("img").css("width") == "100px", "Your <code>img</code> tag should have a <code>width</code> of 100 pixels.");' <ide> - text: Your <code>img</code> tag should have a <code>height</code> of 100 pixels. <del> testString: 'assert($(''img'').css(''height'') == ''100px'', ''Your <code>img</code> tag should have a <code>height</code> of 100 pixels.'');' <add> testString: 'assert($("img").css("height") == "100px", "Your <code>img</code> tag should have a <code>height</code> of 100 pixels.");' <ide> <ide> ``` <ide> <ide> tests: <ide> <ide> ```html <ide> <style> <del> <add> <ide> </style> <ide> <ide> <img src="https://s3.amazonaws.com/freecodecamp/FCCStickers-CamperBot200x200.jpg" alt="freeCodeCamp sticker that says 'Because CamperBot Cares'"> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/boo-who.english.md <ide> Remember to use <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-yo <ide> ```yml <ide> tests: <ide> - text: <code>booWho(true)</code> should return true. <del> testString: 'assert.strictEqual(booWho(true), true, ''<code>booWho(true)</code> should return true.'');' <add> testString: 'assert.strictEqual(booWho(true), true, "<code>booWho(true)</code> should return true.");' <ide> - text: <code>booWho(false)</code> should return true. <del> testString: 'assert.strictEqual(booWho(false), true, ''<code>booWho(false)</code> should return true.'');' <add> testString: 'assert.strictEqual(booWho(false), true, "<code>booWho(false)</code> should return true.");' <ide> - text: '<code>booWho([1, 2, 3])</code> should return false.' <del> testString: 'assert.strictEqual(booWho([1, 2, 3]), false, ''<code>booWho([1, 2, 3])</code> should return false.'');' <add> testString: 'assert.strictEqual(booWho([1, 2, 3]), false, "<code>booWho([1, 2, 3])</code> should return false.");' <ide> - text: '<code>booWho([].slice)</code> should return false.' <del> testString: 'assert.strictEqual(booWho([].slice), false, ''<code>booWho([].slice)</code> should return false.'');' <add> testString: 'assert.strictEqual(booWho([].slice), false, "<code>booWho([].slice)</code> should return false.");' <ide> - text: '<code>booWho({ "a": 1 })</code> should return false.' <del> testString: 'assert.strictEqual(booWho({ "a": 1 }), false, ''<code>booWho({ "a": 1 })</code> should return false.'');' <add> testString: 'assert.strictEqual(booWho({ "a": 1 }), false, "<code>booWho({ "a": 1 })</code> should return false.");' <ide> - text: <code>booWho(1)</code> should return false. <del> testString: 'assert.strictEqual(booWho(1), false, ''<code>booWho(1)</code> should return false.'');' <add> testString: 'assert.strictEqual(booWho(1), false, "<code>booWho(1)</code> should return false.");' <ide> - text: <code>booWho(NaN)</code> should return false. <del> testString: 'assert.strictEqual(booWho(NaN), false, ''<code>booWho(NaN)</code> should return false.'');' <add> testString: 'assert.strictEqual(booWho(NaN), false, "<code>booWho(NaN)</code> should return false.");' <ide> - text: <code>booWho("a")</code> should return false. <del> testString: 'assert.strictEqual(booWho("a"), false, ''<code>booWho("a")</code> should return false.'');' <add> testString: 'assert.strictEqual(booWho("a"), false, "<code>booWho("a")</code> should return false.");' <ide> - text: <code>booWho("true")</code> should return false. <del> testString: 'assert.strictEqual(booWho("true"), false, ''<code>booWho("true")</code> should return false.'');' <add> testString: 'assert.strictEqual(booWho("true"), false, "<code>booWho("true")</code> should return false.");' <ide> - text: <code>booWho("false")</code> should return false. <del> testString: 'assert.strictEqual(booWho("false"), false, ''<code>booWho("false")</code> should return false.'');' <add> testString: 'assert.strictEqual(booWho("false"), false, "<code>booWho("false")</code> should return false.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/chunky-monkey.english.md <ide> Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo <ide> ```yml <ide> tests: <ide> - text: '<code>chunkArrayInGroups(["a", "b", "c", "d"], 2)</code> should return <code>[["a", "b"], ["c", "d"]]</code>.' <del> testString: 'assert.deepEqual(chunkArrayInGroups(["a", "b", "c", "d"], 2), [["a", "b"], ["c", "d"]], ''<code>chunkArrayInGroups(["a", "b", "c", "d"], 2)</code> should return <code>[["a", "b"], ["c", "d"]]</code>.'');' <add> testString: 'assert.deepEqual(chunkArrayInGroups(["a", "b", "c", "d"], 2), [["a", "b"], ["c", "d"]], "<code>chunkArrayInGroups(["a", "b", "c", "d"], 2)</code> should return <code>[["a", "b"], ["c", "d"]]</code>.");' <ide> - text: '<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3)</code> should return <code>[[0, 1, 2], [3, 4, 5]]</code>.' <del> testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], ''<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3)</code> should return <code>[[0, 1, 2], [3, 4, 5]]</code>.'');' <add> testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], "<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3)</code> should return <code>[[0, 1, 2], [3, 4, 5]]</code>.");' <ide> - text: '<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2)</code> should return <code>[[0, 1], [2, 3], [4, 5]]</code>.' <del> testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2), [[0, 1], [2, 3], [4, 5]], ''<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2)</code> should return <code>[[0, 1], [2, 3], [4, 5]]</code>.'');' <add> testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2), [[0, 1], [2, 3], [4, 5]], "<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2)</code> should return <code>[[0, 1], [2, 3], [4, 5]]</code>.");' <ide> - text: '<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4)</code> should return <code>[[0, 1, 2, 3], [4, 5]]</code>.' <del> testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], ''<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4)</code> should return <code>[[0, 1, 2, 3], [4, 5]]</code>.'');' <add> testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], "<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4)</code> should return <code>[[0, 1, 2, 3], [4, 5]]</code>.");' <ide> - text: '<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3)</code> should return <code>[[0, 1, 2], [3, 4, 5], [6]]</code>.' <del> testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3), [[0, 1, 2], [3, 4, 5], [6]], ''<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3)</code> should return <code>[[0, 1, 2], [3, 4, 5], [6]]</code>.'');' <add> testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3), [[0, 1, 2], [3, 4, 5], [6]], "<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3)</code> should return <code>[[0, 1, 2], [3, 4, 5], [6]]</code>.");' <ide> - text: '<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4)</code> should return <code>[[0, 1, 2, 3], [4, 5, 6, 7], [8]]</code>.' <del> testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4), [[0, 1, 2, 3], [4, 5, 6, 7], [8]], ''<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4)</code> should return <code>[[0, 1, 2, 3], [4, 5, 6, 7], [8]]</code>.'');' <add> testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4), [[0, 1, 2, 3], [4, 5, 6, 7], [8]], "<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4)</code> should return <code>[[0, 1, 2, 3], [4, 5, 6, 7], [8]]</code>.");' <ide> - text: '<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2)</code> should return <code>[[0, 1], [2, 3], [4, 5], [6, 7], [8]]</code>.' <del> testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2), [[0, 1], [2, 3], [4, 5], [6, 7], [8]], ''<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2)</code> should return <code>[[0, 1], [2, 3], [4, 5], [6, 7], [8]]</code>.'');' <add> testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2), [[0, 1], [2, 3], [4, 5], [6, 7], [8]], "<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2)</code> should return <code>[[0, 1], [2, 3], [4, 5], [6, 7], [8]]</code>.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.english.md <ide> Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo <ide> ```yml <ide> tests: <ide> - text: '<code>confirmEnding("Bastian", "n")</code> should return true.' <del> testString: 'assert(confirmEnding("Bastian", "n") === true, ''<code>confirmEnding("Bastian", "n")</code> should return true.'');' <add> testString: 'assert(confirmEnding("Bastian", "n") === true, "<code>confirmEnding("Bastian", "n")</code> should return true.");' <ide> - text: '<code>confirmEnding("Congratulation", "on")</code> should return true.' <del> testString: 'assert(confirmEnding("Congratulation", "on") === true, ''<code>confirmEnding("Congratulation", "on")</code> should return true.'');' <add> testString: 'assert(confirmEnding("Congratulation", "on") === true, "<code>confirmEnding("Congratulation", "on")</code> should return true.");' <ide> - text: '<code>confirmEnding("Connor", "n")</code> should return false.' <del> testString: 'assert(confirmEnding("Connor", "n") === false, ''<code>confirmEnding("Connor", "n")</code> should return false.'');' <add> testString: 'assert(confirmEnding("Connor", "n") === false, "<code>confirmEnding("Connor", "n")</code> should return false.");' <ide> - text: '<code>confirmEnding("Walking on water and developing software from a specification are easy if both are frozen"&#44; "specification"&#41;</code> should return false.' <del> testString: 'assert(confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification") === false, ''<code>confirmEnding("Walking on water and developing software from a specification are easy if both are frozen"&#44; "specification"&#41;</code> should return false.'');' <add> testString: 'assert(confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification") === false, "<code>confirmEnding("Walking on water and developing software from a specification are easy if both are frozen"&#44; "specification"&#41;</code> should return false.");' <ide> - text: '<code>confirmEnding("He has to give me a new name", "name")</code> should return true.' <del> testString: 'assert(confirmEnding("He has to give me a new name", "name") === true, ''<code>confirmEnding("He has to give me a new name", "name")</code> should return true.'');' <add> testString: 'assert(confirmEnding("He has to give me a new name", "name") === true, "<code>confirmEnding("He has to give me a new name", "name")</code> should return true.");' <ide> - text: '<code>confirmEnding("Open sesame", "same")</code> should return true.' <del> testString: 'assert(confirmEnding("Open sesame", "same") === true, ''<code>confirmEnding("Open sesame", "same")</code> should return true.'');' <add> testString: 'assert(confirmEnding("Open sesame", "same") === true, "<code>confirmEnding("Open sesame", "same")</code> should return true.");' <ide> - text: '<code>confirmEnding("Open sesame", "pen")</code> should return false.' <del> testString: 'assert(confirmEnding("Open sesame", "pen") === false, ''<code>confirmEnding("Open sesame", "pen")</code> should return false.'');' <add> testString: 'assert(confirmEnding("Open sesame", "pen") === false, "<code>confirmEnding("Open sesame", "pen")</code> should return false.");' <ide> - text: '<code>confirmEnding("Open sesame", "game")</code> should return false.' <del> testString: 'assert(confirmEnding("Open sesame", "game") === false, ''<code>confirmEnding("Open sesame", "game")</code> should return false.'');' <add> testString: 'assert(confirmEnding("Open sesame", "game") === false, "<code>confirmEnding("Open sesame", "game")</code> should return false.");' <ide> - text: '<code>confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain")</code> should return false.' <del> testString: 'assert(confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain") === false, ''<code>confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain")</code> should return false.'');' <add> testString: 'assert(confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain") === false, "<code>confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain")</code> should return false.");' <ide> - text: '<code>confirmEnding("Abstraction", "action")</code> should return true.' <del> testString: 'assert(confirmEnding("Abstraction", "action") === true, ''<code>confirmEnding("Abstraction", "action")</code> should return true.'');' <add> testString: 'assert(confirmEnding("Abstraction", "action") === true, "<code>confirmEnding("Abstraction", "action")</code> should return true.");' <ide> - text: Do not use the built-in method <code>.endsWith()</code> to solve the challenge. <del> testString: 'assert(!(/\.endsWith\(.*?\)\s*?;?/.test(code)) && !(/\[''endsWith''\]/.test(code)), ''Do not use the built-in method <code>.endsWith()</code> to solve the challenge.'');' <add> testString: 'assert(!(/\.endsWith\(.*?\)\s*?;?/.test(code)) && !(/\["endsWith"\]/.test(code)), "Do not use the built-in method <code>.endsWith()</code> to solve the challenge.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/convert-celsius-to-fahrenheit.english.md <ide> Don't worry too much about the function and return statements as they will be co <ide> ```yml <ide> tests: <ide> - text: <code>convertToF(0)</code> should return a number <del> testString: 'assert(typeof convertToF(0) === ''number'', ''<code>convertToF(0)</code> should return a number'');' <add> testString: 'assert(typeof convertToF(0) === "number", "<code>convertToF(0)</code> should return a number");' <ide> - text: <code>convertToF(-30)</code> should return a value of <code>-22</code> <del> testString: 'assert(convertToF(-30) === -22, ''<code>convertToF(-30)</code> should return a value of <code>-22</code>'');' <add> testString: 'assert(convertToF(-30) === -22, "<code>convertToF(-30)</code> should return a value of <code>-22</code>");' <ide> - text: <code>convertToF(-10)</code> should return a value of <code>14</code> <del> testString: 'assert(convertToF(-10) === 14, ''<code>convertToF(-10)</code> should return a value of <code>14</code>'');' <add> testString: 'assert(convertToF(-10) === 14, "<code>convertToF(-10)</code> should return a value of <code>14</code>");' <ide> - text: <code>convertToF(0)</code> should return a value of <code>32</code> <del> testString: 'assert(convertToF(0) === 32, ''<code>convertToF(0)</code> should return a value of <code>32</code>'');' <add> testString: 'assert(convertToF(0) === 32, "<code>convertToF(0)</code> should return a value of <code>32</code>");' <ide> - text: <code>convertToF(20)</code> should return a value of <code>68</code> <del> testString: 'assert(convertToF(20) === 68, ''<code>convertToF(20)</code> should return a value of <code>68</code>'');' <add> testString: 'assert(convertToF(20) === 68, "<code>convertToF(20)</code> should return a value of <code>68</code>");' <ide> - text: <code>convertToF(30)</code> should return a value of <code>86</code> <del> testString: 'assert(convertToF(30) === 86, ''<code>convertToF(30)</code> should return a value of <code>86</code>'');' <add> testString: 'assert(convertToF(30) === 86, "<code>convertToF(30)</code> should return a value of <code>86</code>");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/factorialize-a-number.english.md <ide> Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo <ide> ```yml <ide> tests: <ide> - text: <code>factorialize(5)</code> should return a number. <del> testString: 'assert(typeof factorialize(5) === ''number'', ''<code>factorialize(5)</code> should return a number.'');' <add> testString: 'assert(typeof factorialize(5) === "number", "<code>factorialize(5)</code> should return a number.");' <ide> - text: <code>factorialize(5)</code> should return 120. <del> testString: 'assert(factorialize(5) === 120, ''<code>factorialize(5)</code> should return 120.'');' <add> testString: 'assert(factorialize(5) === 120, "<code>factorialize(5)</code> should return 120.");' <ide> - text: <code>factorialize(10)</code> should return 3628800. <del> testString: 'assert(factorialize(10) === 3628800, ''<code>factorialize(10)</code> should return 3628800.'');' <add> testString: 'assert(factorialize(10) === 3628800, "<code>factorialize(10)</code> should return 3628800.");' <ide> - text: <code>factorialize(20)</code> should return 2432902008176640000. <del> testString: 'assert(factorialize(20) === 2432902008176640000, ''<code>factorialize(20)</code> should return 2432902008176640000.'');' <add> testString: 'assert(factorialize(20) === 2432902008176640000, "<code>factorialize(20)</code> should return 2432902008176640000.");' <ide> - text: <code>factorialize(0)</code> should return 1. <del> testString: 'assert(factorialize(0) === 1, ''<code>factorialize(0)</code> should return 1.'');' <add> testString: 'assert(factorialize(0) === 1, "<code>factorialize(0)</code> should return 1.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/falsy-bouncer.english.md <ide> Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo <ide> ```yml <ide> tests: <ide> - text: '<code>bouncer([7, "ate", "", false, 9])</code> should return <code>[7, "ate", 9]</code>.' <del> testString: 'assert.deepEqual(bouncer([7, "ate", "", false, 9]), [7, "ate", 9], ''<code>bouncer([7, "ate", "", false, 9])</code> should return <code>[7, "ate", 9]</code>.'');' <add> testString: 'assert.deepEqual(bouncer([7, "ate", "", false, 9]), [7, "ate", 9], "<code>bouncer([7, "ate", "", false, 9])</code> should return <code>[7, "ate", 9]</code>.");' <ide> - text: '<code>bouncer(["a", "b", "c"])</code> should return <code>["a", "b", "c"]</code>.' <del> testString: 'assert.deepEqual(bouncer(["a", "b", "c"]), ["a", "b", "c"], ''<code>bouncer(["a", "b", "c"])</code> should return <code>["a", "b", "c"]</code>.'');' <add> testString: 'assert.deepEqual(bouncer(["a", "b", "c"]), ["a", "b", "c"], "<code>bouncer(["a", "b", "c"])</code> should return <code>["a", "b", "c"]</code>.");' <ide> - text: '<code>bouncer([false, null, 0, NaN, undefined, ""])</code> should return <code>[]</code>.' <del> testString: 'assert.deepEqual(bouncer([false, null, 0, NaN, undefined, ""]), [], ''<code>bouncer([false, null, 0, NaN, undefined, ""])</code> should return <code>[]</code>.'');' <add> testString: 'assert.deepEqual(bouncer([false, null, 0, NaN, undefined, ""]), [], "<code>bouncer([false, null, 0, NaN, undefined, ""])</code> should return <code>[]</code>.");' <ide> - text: '<code>bouncer([1, null, NaN, 2, undefined])</code> should return <code>[1, 2]</code>.' <del> testString: 'assert.deepEqual(bouncer([1, null, NaN, 2, undefined]), [1, 2], ''<code>bouncer([1, null, NaN, 2, undefined])</code> should return <code>[1, 2]</code>.'');' <add> testString: 'assert.deepEqual(bouncer([1, null, NaN, 2, undefined]), [1, 2], "<code>bouncer([1, null, NaN, 2, undefined])</code> should return <code>[1, 2]</code>.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/find-the-longest-word-in-a-string.english.md <ide> Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo <ide> ```yml <ide> tests: <ide> - text: <code>findLongestWordLength("The quick brown fox jumped over the lazy dog")</code> should return a number. <del> testString: 'assert(typeof findLongestWordLength("The quick brown fox jumped over the lazy dog") === "number", ''<code>findLongestWordLength("The quick brown fox jumped over the lazy dog")</code> should return a number.'');' <add> testString: 'assert(typeof findLongestWordLength("The quick brown fox jumped over the lazy dog") === "number", "<code>findLongestWordLength("The quick brown fox jumped over the lazy dog")</code> should return a number.");' <ide> - text: <code>findLongestWordLength("The quick brown fox jumped over the lazy dog")</code> should return 6. <del> testString: 'assert(findLongestWordLength("The quick brown fox jumped over the lazy dog") === 6, ''<code>findLongestWordLength("The quick brown fox jumped over the lazy dog")</code> should return 6.'');' <add> testString: 'assert(findLongestWordLength("The quick brown fox jumped over the lazy dog") === 6, "<code>findLongestWordLength("The quick brown fox jumped over the lazy dog")</code> should return 6.");' <ide> - text: <code>findLongestWordLength("May the force be with you")</code> should return 5. <del> testString: 'assert(findLongestWordLength("May the force be with you") === 5, ''<code>findLongestWordLength("May the force be with you")</code> should return 5.'');' <add> testString: 'assert(findLongestWordLength("May the force be with you") === 5, "<code>findLongestWordLength("May the force be with you")</code> should return 5.");' <ide> - text: <code>findLongestWordLength("Google do a barrel roll")</code> should return 6. <del> testString: 'assert(findLongestWordLength("Google do a barrel roll") === 6, ''<code>findLongestWordLength("Google do a barrel roll")</code> should return 6.'');' <add> testString: 'assert(findLongestWordLength("Google do a barrel roll") === 6, "<code>findLongestWordLength("Google do a barrel roll")</code> should return 6.");' <ide> - text: <code>findLongestWordLength("What is the average airspeed velocity of an unladen swallow")</code> should return 8. <del> testString: 'assert(findLongestWordLength("What is the average airspeed velocity of an unladen swallow") === 8, ''<code>findLongestWordLength("What is the average airspeed velocity of an unladen swallow")</code> should return 8.'');' <add> testString: 'assert(findLongestWordLength("What is the average airspeed velocity of an unladen swallow") === 8, "<code>findLongestWordLength("What is the average airspeed velocity of an unladen swallow")</code> should return 8.");' <ide> - text: <code>findLongestWordLength("What if we try a super-long word such as otorhinolaryngology")</code> should return 19. <del> testString: 'assert(findLongestWordLength("What if we try a super-long word such as otorhinolaryngology") === 19, ''<code>findLongestWordLength("What if we try a super-long word such as otorhinolaryngology")</code> should return 19.'');' <add> testString: 'assert(findLongestWordLength("What if we try a super-long word such as otorhinolaryngology") === 19, "<code>findLongestWordLength("What if we try a super-long word such as otorhinolaryngology")</code> should return 19.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/finders-keepers.english.md <ide> Remember to use <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-yo <ide> ```yml <ide> tests: <ide> - text: '<code>findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; })</code> should return 8.' <del> testString: 'assert.strictEqual(findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; }), 8, ''<code>findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; })</code> should return 8.'');' <add> testString: 'assert.strictEqual(findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; }), 8, "<code>findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; })</code> should return 8.");' <ide> - text: '<code>findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; })</code> should return undefined.' <del> testString: 'assert.strictEqual(findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; }), undefined, ''<code>findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; })</code> should return undefined.'');' <add> testString: 'assert.strictEqual(findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; }), undefined, "<code>findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; })</code> should return undefined.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations.english.md <ide> Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo <ide> ```yml <ide> tests: <ide> - text: '<code>mutation(["hello", "hey"])</code> should return false.' <del> testString: 'assert(mutation(["hello", "hey"]) === false, ''<code>mutation(["hello", "hey"])</code> should return false.'');' <add> testString: 'assert(mutation(["hello", "hey"]) === false, "<code>mutation(["hello", "hey"])</code> should return false.");' <ide> - text: '<code>mutation(["hello", "Hello"])</code> should return true.' <del> testString: 'assert(mutation(["hello", "Hello"]) === true, ''<code>mutation(["hello", "Hello"])</code> should return true.'');' <add> testString: 'assert(mutation(["hello", "Hello"]) === true, "<code>mutation(["hello", "Hello"])</code> should return true.");' <ide> - text: '<code>mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"])</code> should return true.' <del> testString: 'assert(mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"]) === true, ''<code>mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"])</code> should return true.'');' <add> testString: 'assert(mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"]) === true, "<code>mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"])</code> should return true.");' <ide> - text: '<code>mutation(["Mary", "Army"])</code> should return true.' <del> testString: 'assert(mutation(["Mary", "Army"]) === true, ''<code>mutation(["Mary", "Army"])</code> should return true.'');' <add> testString: 'assert(mutation(["Mary", "Army"]) === true, "<code>mutation(["Mary", "Army"])</code> should return true.");' <ide> - text: '<code>mutation(["Mary", "Aarmy"])</code> should return true.' <del> testString: 'assert(mutation(["Mary", "Aarmy"]) === true, ''<code>mutation(["Mary", "Aarmy"])</code> should return true.'');' <add> testString: 'assert(mutation(["Mary", "Aarmy"]) === true, "<code>mutation(["Mary", "Aarmy"])</code> should return true.");' <ide> - text: '<code>mutation(["Alien", "line"])</code> should return true.' <del> testString: 'assert(mutation(["Alien", "line"]) === true, ''<code>mutation(["Alien", "line"])</code> should return true.'');' <add> testString: 'assert(mutation(["Alien", "line"]) === true, "<code>mutation(["Alien", "line"])</code> should return true.");' <ide> - text: '<code>mutation(["floor", "for"])</code> should return true.' <del> testString: 'assert(mutation(["floor", "for"]) === true, ''<code>mutation(["floor", "for"])</code> should return true.'');' <add> testString: 'assert(mutation(["floor", "for"]) === true, "<code>mutation(["floor", "for"])</code> should return true.");' <ide> - text: '<code>mutation(["hello", "neo"])</code> should return false.' <del> testString: 'assert(mutation(["hello", "neo"]) === false, ''<code>mutation(["hello", "neo"])</code> should return false.'');' <add> testString: 'assert(mutation(["hello", "neo"]) === false, "<code>mutation(["hello", "neo"])</code> should return false.");' <ide> - text: '<code>mutation(["voodoo", "no"])</code> should return false.' <del> testString: 'assert(mutation(["voodoo", "no"]) === false, ''<code>mutation(["voodoo", "no"])</code> should return false.'');' <add> testString: 'assert(mutation(["voodoo", "no"]) === false, "<code>mutation(["voodoo", "no"])</code> should return false.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.english.md <ide> Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo <ide> ```yml <ide> tests: <ide> - text: '<code>repeatStringNumTimes("*", 3)</code> should return <code>"***"</code>.' <del> testString: 'assert(repeatStringNumTimes("*", 3) === "***", ''<code>repeatStringNumTimes("*", 3)</code> should return <code>"***"</code>.'');' <add> testString: 'assert(repeatStringNumTimes("*", 3) === "***", "<code>repeatStringNumTimes("*", 3)</code> should return <code>"***"</code>.");' <ide> - text: '<code>repeatStringNumTimes("abc", 3)</code> should return <code>"abcabcabc"</code>.' <del> testString: 'assert(repeatStringNumTimes("abc", 3) === "abcabcabc", ''<code>repeatStringNumTimes("abc", 3)</code> should return <code>"abcabcabc"</code>.'');' <add> testString: 'assert(repeatStringNumTimes("abc", 3) === "abcabcabc", "<code>repeatStringNumTimes("abc", 3)</code> should return <code>"abcabcabc"</code>.");' <ide> - text: '<code>repeatStringNumTimes("abc", 4)</code> should return <code>"abcabcabcabc"</code>.' <del> testString: 'assert(repeatStringNumTimes("abc", 4) === "abcabcabcabc", ''<code>repeatStringNumTimes("abc", 4)</code> should return <code>"abcabcabcabc"</code>.'');' <add> testString: 'assert(repeatStringNumTimes("abc", 4) === "abcabcabcabc", "<code>repeatStringNumTimes("abc", 4)</code> should return <code>"abcabcabcabc"</code>.");' <ide> - text: '<code>repeatStringNumTimes("abc", 1)</code> should return <code>"abc"</code>.' <del> testString: 'assert(repeatStringNumTimes("abc", 1) === "abc", ''<code>repeatStringNumTimes("abc", 1)</code> should return <code>"abc"</code>.'');' <add> testString: 'assert(repeatStringNumTimes("abc", 1) === "abc", "<code>repeatStringNumTimes("abc", 1)</code> should return <code>"abc"</code>.");' <ide> - text: '<code>repeatStringNumTimes("*", 8)</code> should return <code>"********"</code>.' <del> testString: 'assert(repeatStringNumTimes("*", 8) === "********", ''<code>repeatStringNumTimes("*", 8)</code> should return <code>"********"</code>.'');' <add> testString: 'assert(repeatStringNumTimes("*", 8) === "********", "<code>repeatStringNumTimes("*", 8)</code> should return <code>"********"</code>.");' <ide> - text: '<code>repeatStringNumTimes("abc", -2)</code> should return <code>""</code>.' <del> testString: 'assert(repeatStringNumTimes("abc", -2) === "", ''<code>repeatStringNumTimes("abc", -2)</code> should return <code>""</code>.'');' <add> testString: 'assert(repeatStringNumTimes("abc", -2) === "", "<code>repeatStringNumTimes("abc", -2)</code> should return <code>""</code>.");' <ide> - text: The built-in <code>repeat()</code>-method should not be used <del> testString: 'assert(!/\.repeat/g.test(code), ''The built-in <code>repeat()</code>-method should not be used'');' <add> testString: 'assert(!/\.repeat/g.test(code), "The built-in <code>repeat()</code>-method should not be used");' <ide> <ide> ``` <ide> <ide> repeatStringNumTimes("abc", 3); <ide> <ide> ```js <ide> function repeatStringNumTimes(str, num) { <del> if (num < 0) return ''; <add> if (num < 0) return "; <ide> return num === 1 ? str : str + repeatStringNumTimes(str, num-1); <ide> } <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/return-largest-numbers-in-arrays.english.md <ide> Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo <ide> ```yml <ide> tests: <ide> - text: '<code>largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])</code> should return an array.' <del> testString: 'assert(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]).constructor === Array, ''<code>largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])</code> should return an array.'');' <add> testString: 'assert(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]).constructor === Array, "<code>largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])</code> should return an array.");' <ide> - text: '<code>largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])</code> should return <code>[27, 5, 39, 1001]</code>.' <del> testString: 'assert.deepEqual(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]), [27, 5, 39, 1001], ''<code>largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])</code> should return <code>[27, 5, 39, 1001]</code>.'');' <add> testString: 'assert.deepEqual(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]), [27, 5, 39, 1001], "<code>largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])</code> should return <code>[27, 5, 39, 1001]</code>.");' <ide> - text: '<code>largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]])</code> should return <code>[9, 35, 97, 1000000]</code>.' <del> testString: 'assert.deepEqual(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]), [9, 35, 97, 1000000], ''<code>largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]])</code> should return <code>[9, 35, 97, 1000000]</code>.'');' <add> testString: 'assert.deepEqual(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]), [9, 35, 97, 1000000], "<code>largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]])</code> should return <code>[9, 35, 97, 1000000]</code>.");' <ide> - text: '<code>largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]])</code> should return <code>[25, 48, 21, -3]</code>.' <del> testString: 'assert.deepEqual(largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]]), [25, 48, 21, -3], ''<code>largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]])</code> should return <code>[25, 48, 21, -3]</code>.'');' <add> testString: 'assert.deepEqual(largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]]), [25, 48, 21, -3], "<code>largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]])</code> should return <code>[25, 48, 21, -3]</code>.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string.english.md <ide> Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo <ide> ```yml <ide> tests: <ide> - text: <code>reverseString("hello")</code> should return a string. <del> testString: 'assert(typeof reverseString("hello") === "string", ''<code>reverseString("hello")</code> should return a string.'');' <add> testString: 'assert(typeof reverseString("hello") === "string", "<code>reverseString("hello")</code> should return a string.");' <ide> - text: <code>reverseString("hello")</code> should become <code>"olleh"</code>. <del> testString: 'assert(reverseString("hello") === "olleh", ''<code>reverseString("hello")</code> should become <code>"olleh"</code>.'');' <add> testString: 'assert(reverseString("hello") === "olleh", "<code>reverseString("hello")</code> should become <code>"olleh"</code>.");' <ide> - text: <code>reverseString("Howdy")</code> should become <code>"ydwoH"</code>. <del> testString: 'assert(reverseString("Howdy") === "ydwoH", ''<code>reverseString("Howdy")</code> should become <code>"ydwoH"</code>.'');' <add> testString: 'assert(reverseString("Howdy") === "ydwoH", "<code>reverseString("Howdy")</code> should become <code>"ydwoH"</code>.");' <ide> - text: <code>reverseString("Greetings from Earth")</code> should return <code>"htraE morf sgniteerG"</code>. <del> testString: 'assert(reverseString("Greetings from Earth") === "htraE morf sgniteerG", ''<code>reverseString("Greetings from Earth")</code> should return <code>"htraE morf sgniteerG"</code>.'');' <add> testString: 'assert(reverseString("Greetings from Earth") === "htraE morf sgniteerG", "<code>reverseString("Greetings from Earth")</code> should return <code>"htraE morf sgniteerG"</code>.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice.english.md <ide> Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo <ide> ```yml <ide> tests: <ide> - text: '<code>frankenSplice([1, 2, 3], [4, 5], 1)</code> should return <code>[4, 1, 2, 3, 5]</code>.' <del> testString: 'assert.deepEqual(frankenSplice([1, 2, 3], [4, 5], 1), [4, 1, 2, 3, 5], ''<code>frankenSplice([1, 2, 3], [4, 5], 1)</code> should return <code>[4, 1, 2, 3, 5]</code>.'');' <add> testString: 'assert.deepEqual(frankenSplice([1, 2, 3], [4, 5], 1), [4, 1, 2, 3, 5], "<code>frankenSplice([1, 2, 3], [4, 5], 1)</code> should return <code>[4, 1, 2, 3, 5]</code>.");' <ide> - text: '<code>frankenSplice([1, 2], ["a", "b"], 1)</code> should return <code>["a", 1, 2, "b"]</code>.' <del> testString: 'assert.deepEqual(frankenSplice(testArr1, testArr2, 1), ["a", 1, 2, "b"], ''<code>frankenSplice([1, 2], ["a", "b"], 1)</code> should return <code>["a", 1, 2, "b"]</code>.'');' <add> testString: 'assert.deepEqual(frankenSplice(testArr1, testArr2, 1), ["a", 1, 2, "b"], "<code>frankenSplice([1, 2], ["a", "b"], 1)</code> should return <code>["a", 1, 2, "b"]</code>.");' <ide> - text: '<code>frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2)</code> should return <code>["head", "shoulders", "claw", "tentacle", "knees", "toes"]</code>.' <del> testString: 'assert.deepEqual(frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2), ["head", "shoulders", "claw", "tentacle", "knees", "toes"], ''<code>frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2)</code> should return <code>["head", "shoulders", "claw", "tentacle", "knees", "toes"]</code>.'');' <add> testString: 'assert.deepEqual(frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2), ["head", "shoulders", "claw", "tentacle", "knees", "toes"], "<code>frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2)</code> should return <code>["head", "shoulders", "claw", "tentacle", "knees", "toes"]</code>.");' <ide> - text: All elements from the first array should be added to the second array in their original order. <del> testString: 'assert.deepEqual(frankenSplice([1, 2, 3, 4], [], 0), [1, 2, 3, 4], ''All elements from the first array should be added to the second array in their original order.'');' <add> testString: 'assert.deepEqual(frankenSplice([1, 2, 3, 4], [], 0), [1, 2, 3, 4], "All elements from the first array should be added to the second array in their original order.");' <ide> - text: The first array should remain the same after the function runs. <del> testString: 'assert(testArr1[0] === 1 && testArr1[1] === 2, ''The first array should remain the same after the function runs.'');' <add> testString: 'assert(testArr1[0] === 1 && testArr1[1] === 2, "The first array should remain the same after the function runs.");' <ide> - text: The second array should remain the same after the function runs. <del> testString: 'assert(testArr2[0] === "a" && testArr2[1] === "b", ''The second array should remain the same after the function runs.'');' <add> testString: 'assert(testArr2[0] === "a" && testArr2[1] === "b", "The second array should remain the same after the function runs.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence.english.md <ide> Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo <ide> ```yml <ide> tests: <ide> - text: '<code>titleCase("I&#39;m a little tea pot")</code> should return a string.' <del> testString: 'assert(typeof titleCase("I''m a little tea pot") === "string", ''<code>titleCase("I&#39;m a little tea pot")</code> should return a string.'');' <add> testString: 'assert(typeof titleCase("I"m a little tea pot") === "string", "<code>titleCase("I&#39;m a little tea pot")</code> should return a string.");' <ide> - text: '<code>titleCase("I&#39;m a little tea pot")</code> should return <code>I&#39;m A Little Tea Pot</code>.' <del> testString: 'assert(titleCase("I''m a little tea pot") === "I''m A Little Tea Pot", ''<code>titleCase("I&#39;m a little tea pot")</code> should return <code>I&#39;m A Little Tea Pot</code>.'');' <add> testString: 'assert(titleCase("I"m a little tea pot") === "I"m A Little Tea Pot", "<code>titleCase("I&#39;m a little tea pot")</code> should return <code>I&#39;m A Little Tea Pot</code>.");' <ide> - text: <code>titleCase("sHoRt AnD sToUt")</code> should return <code>Short And Stout</code>. <del> testString: 'assert(titleCase("sHoRt AnD sToUt") === "Short And Stout", ''<code>titleCase("sHoRt AnD sToUt")</code> should return <code>Short And Stout</code>.'');' <add> testString: 'assert(titleCase("sHoRt AnD sToUt") === "Short And Stout", "<code>titleCase("sHoRt AnD sToUt")</code> should return <code>Short And Stout</code>.");' <ide> - text: <code>titleCase("HERE IS MY HANDLE HERE IS MY SPOUT")</code> should return <code>Here Is My Handle Here Is My Spout</code>. <del> testString: 'assert(titleCase("HERE IS MY HANDLE HERE IS MY SPOUT") === "Here Is My Handle Here Is My Spout", ''<code>titleCase("HERE IS MY HANDLE HERE IS MY SPOUT")</code> should return <code>Here Is My Handle Here Is My Spout</code>.'');' <add> testString: 'assert(titleCase("HERE IS MY HANDLE HERE IS MY SPOUT") === "Here Is My Handle Here Is My Spout", "<code>titleCase("HERE IS MY HANDLE HERE IS MY SPOUT")</code> should return <code>Here Is My Handle Here Is My Spout</code>.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/truncate-a-string.english.md <ide> Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo <ide> ```yml <ide> tests: <ide> - text: '<code>truncateString("A-tisket a-tasket A green and yellow basket", 8)</code> should return "A-tisket...".' <del> testString: 'assert(truncateString("A-tisket a-tasket A green and yellow basket", 8) === "A-tisket...", ''<code>truncateString("A-tisket a-tasket A green and yellow basket", 8)</code> should return "A-tisket...".'');' <add> testString: 'assert(truncateString("A-tisket a-tasket A green and yellow basket", 8) === "A-tisket...", "<code>truncateString("A-tisket a-tasket A green and yellow basket", 8)</code> should return "A-tisket...".");' <ide> - text: '<code>truncateString("Peter Piper picked a peck of pickled peppers", 11)</code> should return "Peter Piper...".' <del> testString: 'assert(truncateString("Peter Piper picked a peck of pickled peppers", 11) === "Peter Piper...", ''<code>truncateString("Peter Piper picked a peck of pickled peppers", 11)</code> should return "Peter Piper...".'');' <add> testString: 'assert(truncateString("Peter Piper picked a peck of pickled peppers", 11) === "Peter Piper...", "<code>truncateString("Peter Piper picked a peck of pickled peppers", 11)</code> should return "Peter Piper...".");' <ide> - text: '<code>truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length)</code> should return "A-tisket a-tasket A green and yellow basket".' <del> testString: 'assert(truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length) === "A-tisket a-tasket A green and yellow basket", ''<code>truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length)</code> should return "A-tisket a-tasket A green and yellow basket".'');' <add> testString: 'assert(truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length) === "A-tisket a-tasket A green and yellow basket", "<code>truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length)</code> should return "A-tisket a-tasket A green and yellow basket".");' <ide> - text: '<code>truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length + 2)</code> should return "A-tisket a-tasket A green and yellow basket".' <del> testString: 'assert(truncateString(''A-tisket a-tasket A green and yellow basket'', ''A-tisket a-tasket A green and yellow basket''.length + 2) === ''A-tisket a-tasket A green and yellow basket'', ''<code>truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length + 2)</code> should return "A-tisket a-tasket A green and yellow basket".'');' <add> testString: 'assert(truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length + 2) === "A-tisket a-tasket A green and yellow basket", "<code>truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length + 2)</code> should return "A-tisket a-tasket A green and yellow basket".");' <ide> - text: '<code>truncateString("A-", 1)</code> should return "A...".' <del> testString: 'assert(truncateString("A-", 1) === "A...", ''<code>truncateString("A-", 1)</code> should return "A...".'');' <add> testString: 'assert(truncateString("A-", 1) === "A...", "<code>truncateString("A-", 1)</code> should return "A...".");' <ide> - text: '<code>truncateString("Absolutely Longer", 2)</code> should return "Ab...".' <del> testString: 'assert(truncateString("Absolutely Longer", 2) === "Ab...", ''<code>truncateString("Absolutely Longer", 2)</code> should return "Ab...".'');' <add> testString: 'assert(truncateString("Absolutely Longer", 2) === "Ab...", "<code>truncateString("Absolutely Longer", 2)</code> should return "Ab...".");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/where-do-i-belong.english.md <ide> Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo <ide> ```yml <ide> tests: <ide> - text: '<code>getIndexToIns([10, 20, 30, 40, 50], 35)</code> should return <code>3</code>.' <del> testString: 'assert(getIndexToIns([10, 20, 30, 40, 50], 35) === 3, ''<code>getIndexToIns([10, 20, 30, 40, 50], 35)</code> should return <code>3</code>.'');' <add> testString: 'assert(getIndexToIns([10, 20, 30, 40, 50], 35) === 3, "<code>getIndexToIns([10, 20, 30, 40, 50], 35)</code> should return <code>3</code>.");' <ide> - text: '<code>getIndexToIns([10, 20, 30, 40, 50], 35)</code> should return a number.' <del> testString: 'assert(typeof(getIndexToIns([10, 20, 30, 40, 50], 35)) === "number", ''<code>getIndexToIns([10, 20, 30, 40, 50], 35)</code> should return a number.'');' <add> testString: 'assert(typeof(getIndexToIns([10, 20, 30, 40, 50], 35)) === "number", "<code>getIndexToIns([10, 20, 30, 40, 50], 35)</code> should return a number.");' <ide> - text: '<code>getIndexToIns([10, 20, 30, 40, 50], 30)</code> should return <code>2</code>.' <del> testString: 'assert(getIndexToIns([10, 20, 30, 40, 50], 30) === 2, ''<code>getIndexToIns([10, 20, 30, 40, 50], 30)</code> should return <code>2</code>.'');' <add> testString: 'assert(getIndexToIns([10, 20, 30, 40, 50], 30) === 2, "<code>getIndexToIns([10, 20, 30, 40, 50], 30)</code> should return <code>2</code>.");' <ide> - text: '<code>getIndexToIns([10, 20, 30, 40, 50], 30)</code> should return a number.' <del> testString: 'assert(typeof(getIndexToIns([10, 20, 30, 40, 50], 30)) === "number", ''<code>getIndexToIns([10, 20, 30, 40, 50], 30)</code> should return a number.'');' <add> testString: 'assert(typeof(getIndexToIns([10, 20, 30, 40, 50], 30)) === "number", "<code>getIndexToIns([10, 20, 30, 40, 50], 30)</code> should return a number.");' <ide> - text: '<code>getIndexToIns([40, 60], 50)</code> should return <code>1</code>.' <del> testString: 'assert(getIndexToIns([40, 60], 50) === 1, ''<code>getIndexToIns([40, 60], 50)</code> should return <code>1</code>.'');' <add> testString: 'assert(getIndexToIns([40, 60], 50) === 1, "<code>getIndexToIns([40, 60], 50)</code> should return <code>1</code>.");' <ide> - text: '<code>getIndexToIns([40, 60], 50)</code> should return a number.' <del> testString: 'assert(typeof(getIndexToIns([40, 60], 50)) === "number", ''<code>getIndexToIns([40, 60], 50)</code> should return a number.'');' <add> testString: 'assert(typeof(getIndexToIns([40, 60], 50)) === "number", "<code>getIndexToIns([40, 60], 50)</code> should return a number.");' <ide> - text: '<code>getIndexToIns([3, 10, 5], 3)</code> should return <code>0</code>.' <del> testString: 'assert(getIndexToIns([3, 10, 5], 3) === 0, ''<code>getIndexToIns([3, 10, 5], 3)</code> should return <code>0</code>.'');' <add> testString: 'assert(getIndexToIns([3, 10, 5], 3) === 0, "<code>getIndexToIns([3, 10, 5], 3)</code> should return <code>0</code>.");' <ide> - text: '<code>getIndexToIns([3, 10, 5], 3)</code> should return a number.' <del> testString: 'assert(typeof(getIndexToIns([3, 10, 5], 3)) === "number", ''<code>getIndexToIns([3, 10, 5], 3)</code> should return a number.'');' <add> testString: 'assert(typeof(getIndexToIns([3, 10, 5], 3)) === "number", "<code>getIndexToIns([3, 10, 5], 3)</code> should return a number.");' <ide> - text: '<code>getIndexToIns([5, 3, 20, 3], 5)</code> should return <code>2</code>.' <del> testString: 'assert(getIndexToIns([5, 3, 20, 3], 5) === 2, ''<code>getIndexToIns([5, 3, 20, 3], 5)</code> should return <code>2</code>.'');' <add> testString: 'assert(getIndexToIns([5, 3, 20, 3], 5) === 2, "<code>getIndexToIns([5, 3, 20, 3], 5)</code> should return <code>2</code>.");' <ide> - text: '<code>getIndexToIns([5, 3, 20, 3], 5)</code> should return a number.' <del> testString: 'assert(typeof(getIndexToIns([5, 3, 20, 3], 5)) === "number", ''<code>getIndexToIns([5, 3, 20, 3], 5)</code> should return a number.'');' <add> testString: 'assert(typeof(getIndexToIns([5, 3, 20, 3], 5)) === "number", "<code>getIndexToIns([5, 3, 20, 3], 5)</code> should return a number.");' <ide> - text: '<code>getIndexToIns([2, 20, 10], 19)</code> should return <code>2</code>.' <del> testString: 'assert(getIndexToIns([2, 20, 10], 19) === 2, ''<code>getIndexToIns([2, 20, 10], 19)</code> should return <code>2</code>.'');' <add> testString: 'assert(getIndexToIns([2, 20, 10], 19) === 2, "<code>getIndexToIns([2, 20, 10], 19)</code> should return <code>2</code>.");' <ide> - text: '<code>getIndexToIns([2, 20, 10], 19)</code> should return a number.' <del> testString: 'assert(typeof(getIndexToIns([2, 20, 10], 19)) === "number", ''<code>getIndexToIns([2, 20, 10], 19)</code> should return a number.'');' <add> testString: 'assert(typeof(getIndexToIns([2, 20, 10], 19)) === "number", "<code>getIndexToIns([2, 20, 10], 19)</code> should return a number.");' <ide> - text: '<code>getIndexToIns([2, 5, 10], 15)</code> should return <code>3</code>.' <del> testString: 'assert(getIndexToIns([2, 5, 10], 15) === 3, ''<code>getIndexToIns([2, 5, 10], 15)</code> should return <code>3</code>.'');' <add> testString: 'assert(getIndexToIns([2, 5, 10], 15) === 3, "<code>getIndexToIns([2, 5, 10], 15)</code> should return <code>3</code>.");' <ide> - text: '<code>getIndexToIns([2, 5, 10], 15)</code> should return a number.' <del> testString: 'assert(typeof(getIndexToIns([2, 5, 10], 15)) === "number", ''<code>getIndexToIns([2, 5, 10], 15)</code> should return a number.'');' <add> testString: 'assert(typeof(getIndexToIns([2, 5, 10], 15)) === "number", "<code>getIndexToIns([2, 5, 10], 15)</code> should return a number.");' <ide> - text: '<code>getIndexToIns([], 1)</code> should return <code>0</code>.' <del> testString: 'assert(getIndexToIns([], 1) === 0, ''<code>getIndexToIns([], 1)</code> should return <code>0</code>.'');' <add> testString: 'assert(getIndexToIns([], 1) === 0, "<code>getIndexToIns([], 1)</code> should return <code>0</code>.");' <ide> - text: '<code>getIndexToIns([], 1)</code> should return a number.' <del> testString: 'assert(typeof(getIndexToIns([], 1)) === "number", ''<code>getIndexToIns([], 1)</code> should return a number.'');' <add> testString: 'assert(typeof(getIndexToIns([], 1)) === "number", "<code>getIndexToIns([], 1)</code> should return a number.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/-iterate-through-the-keys-of-an-object-with-a-for...in-statement.english.md <ide> We've defined a function, <code>countOnline</code>; use a <dfn>for...in</dfn> st <ide> ```yml <ide> tests: <ide> - text: The <code>users</code> object contains users <code>Jeff</code> and <code>Ryan</code> with <code>online</code> set to <code>true</code> and users <code>Alan</code> and <code>Sarah</code> with <code>online</code> set to <code>false</code> <del> testString: 'assert(users.Alan.online === false && users.Jeff.online === true && users.Sarah.online === false && users.Ryan.online === true, ''The <code>users</code> object contains users <code>Jeff</code> and <code>Ryan</code> with <code>online</code> set to <code>true</code> and users <code>Alan</code> and <code>Sarah</code> with <code>online</code> set to <code>false</code>'');' <add> testString: 'assert(users.Alan.online === false && users.Jeff.online === true && users.Sarah.online === false && users.Ryan.online === true, "The <code>users</code> object contains users <code>Jeff</code> and <code>Ryan</code> with <code>online</code> set to <code>true</code> and users <code>Alan</code> and <code>Sarah</code> with <code>online</code> set to <code>false</code>");' <ide> - text: The function <code>countOnline</code> returns the number of users with the <code>online</code> property set to <code>true</code> <del> testString: 'assert((function() { users.Harry = {online: true}; users.Sam = {online: true}; users.Carl = {online: true}; return countOnline(users) })() === 5, ''The function <code>countOnline</code> returns the number of users with the <code>online</code> property set to <code>true</code>'');' <add> testString: 'assert((function() { users.Harry = {online: true}; users.Sam = {online: true}; users.Carl = {online: true}; return countOnline(users) })() === 5, "The function <code>countOnline</code> returns the number of users with the <code>online</code> property set to <code>true</code>");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/access-an-arrays-contents-using-bracket-notation.english.md <ide> In order to complete this challenge, set the 2nd position (index <code>1</code>) <ide> ```yml <ide> tests: <ide> - text: '<code>myArray[0]</code> is equal to <code>"a"</code>' <del> testString: 'assert.strictEqual(myArray[0], "a", ''<code>myArray[0]</code> is equal to <code>"a"</code>'');' <add> testString: 'assert.strictEqual(myArray[0], "a", "<code>myArray[0]</code> is equal to <code>"a"</code>");' <ide> - text: '<code>myArray[1]</code> is no longer set to <code>"b"</code>' <del> testString: 'assert.notStrictEqual(myArray[1], "b", ''<code>myArray[1]</code> is no longer set to <code>"b"</code>'');' <add> testString: 'assert.notStrictEqual(myArray[1], "b", "<code>myArray[1]</code> is no longer set to <code>"b"</code>");' <ide> - text: '<code>myArray[2]</code> is equal to <code>"c"</code>' <del> testString: 'assert.strictEqual(myArray[2], "c", ''<code>myArray[2]</code> is equal to <code>"c"</code>'');' <add> testString: 'assert.strictEqual(myArray[2], "c", "<code>myArray[2]</code> is equal to <code>"c"</code>");' <ide> - text: '<code>myArray[3]</code> is equal to <code>"d"</code>' <del> testString: 'assert.strictEqual(myArray[3], "d", ''<code>myArray[3]</code> is equal to <code>"d"</code>'');' <add> testString: 'assert.strictEqual(myArray[3], "d", "<code>myArray[3]</code> is equal to <code>"d"</code>");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/access-property-names-with-bracket-notation.english.md <ide> We've defined a function, <code>checkInventory</code>, which receives a scanned <ide> ```yml <ide> tests: <ide> - text: <code>checkInventory</code> is a function <del> testString: 'assert.strictEqual(typeof checkInventory, ''function'', ''<code>checkInventory</code> is a function'');' <add> testString: 'assert.strictEqual(typeof checkInventory, "function", "<code>checkInventory</code> is a function");' <ide> - text: 'The <code>foods</code> object should have only the following key-value pairs: <code>apples: 25</code>, <code>oranges: 32</code>, <code>plums: 28</code>, <code>bananas: 13</code>, <code>grapes: 35</code>, <code>strawberries: 27</code>' <del> testString: 'assert.deepEqual(foods, {apples: 25, oranges: 32, plums: 28, bananas: 13, grapes: 35, strawberries: 27}, ''The <code>foods</code> object should have only the following key-value pairs: <code>apples: 25</code>, <code>oranges: 32</code>, <code>plums: 28</code>, <code>bananas: 13</code>, <code>grapes: 35</code>, <code>strawberries: 27</code>'');' <add> testString: 'assert.deepEqual(foods, {apples: 25, oranges: 32, plums: 28, bananas: 13, grapes: 35, strawberries: 27}, "The <code>foods</code> object should have only the following key-value pairs: <code>apples: 25</code>, <code>oranges: 32</code>, <code>plums: 28</code>, <code>bananas: 13</code>, <code>grapes: 35</code>, <code>strawberries: 27</code>");' <ide> - text: <code>checkInventory("apples")</code> should return <code>25</code> <del> testString: 'assert.strictEqual(checkInventory(''apples''), 25, ''<code>checkInventory("apples")</code> should return <code>25</code>'');' <add> testString: 'assert.strictEqual(checkInventory("apples"), 25, "<code>checkInventory("apples")</code> should return <code>25</code>");' <ide> - text: <code>checkInventory("bananas")</code> should return <code>13</code> <del> testString: 'assert.strictEqual(checkInventory(''bananas''), 13, ''<code>checkInventory("bananas")</code> should return <code>13</code>'');' <add> testString: 'assert.strictEqual(checkInventory("bananas"), 13, "<code>checkInventory("bananas")</code> should return <code>13</code>");' <ide> - text: <code>checkInventory("strawberries")</code> should return <code>27</code> <del> testString: 'assert.strictEqual(checkInventory(''strawberries''), 27, ''<code>checkInventory("strawberries")</code> should return <code>27</code>'');' <add> testString: 'assert.strictEqual(checkInventory("strawberries"), 27, "<code>checkInventory("strawberries")</code> should return <code>27</code>");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-to-an-array-with-push-and-unshift.english.md <ide> challengeType: 1 <ide> <ide> ## Description <ide> <section id='description'> <del>An array's length, like the data types it can contain, is not fixed. Arrays can be defined with a length of any number of elements, and elements can be added or removed over time; in other words, arrays are <dfn>mutable</dfn>. In this challenge, we will look at two methods with which we can programmatically modify an array: <code>Array.push()</code> and <code>Array.unshift()</code>. <add>An array's length, like the data types it can contain, is not fixed. Arrays can be defined with a length of any number of elements, and elements can be added or removed over time; in other words, arrays are <dfn>mutable</dfn>. In this challenge, we will look at two methods with which we can programmatically modify an array: <code>Array.push()</code> and <code>Array.unshift()</code>. <ide> Both methods take one or more elements as parameters and add those elements to the array the method is being called on; the <code>push()</code> method adds elements to the end of an array, and <code>unshift()</code> adds elements to the beginning. Consider the following: <ide> <blockquote>let twentyThree = 'XXIII';<br>let romanNumerals = ['XXI', 'XXII'];<br><br>romanNumerals.unshift('XIX', 'XX');<br>// now equals ['XIX', 'XX', 'XXI', 'XXII']<br><br>romanNumerals.push(twentyThree);<br>// now equals ['XIX', 'XX', 'XXI', 'XXII', 'XXIII'] <ide> Notice that we can also pass variables, which allows us even greater flexibility in dynamically modifying our array's data. <ide> We have defined a function, <code>mixedNumbers</code>, which we are passing an a <ide> ```yml <ide> tests: <ide> - text: '<code>mixedNumbers(["IV", 5, "six"])</code> should now return <code>["I", 2, "three", "IV", 5, "six", 7, "VIII", 9]</code>' <del> testString: 'assert.deepEqual(mixedNumbers([''IV'', 5, ''six'']), [''I'', 2, ''three'', ''IV'', 5, ''six'', 7, ''VIII'', 9], ''<code>mixedNumbers(["IV", 5, "six"])</code> should now return <code>["I", 2, "three", "IV", 5, "six", 7, "VIII", 9]</code>'');' <add> testString: 'assert.deepEqual(mixedNumbers(["IV", 5, "six"]), ["I", 2, "three", "IV", 5, "six", 7, "VIII", 9], "<code>mixedNumbers(["IV", 5, "six"])</code> should now return <code>["I", 2, "three", "IV", 5, "six", 7, "VIII", 9]</code>");' <ide> - text: The <code>mixedNumbers</code> function should utilize the <code>push()</code> method <del> testString: 'assert.notStrictEqual(mixedNumbers.toString().search(/\.push\(/), -1, ''The <code>mixedNumbers</code> function should utilize the <code>push()</code> method'');' <add> testString: 'assert.notStrictEqual(mixedNumbers.toString().search(/\.push\(/), -1, "The <code>mixedNumbers</code> function should utilize the <code>push()</code> method");' <ide> - text: The <code>mixedNumbers</code> function should utilize the <code>unshift()</code> method <del> testString: 'assert.notStrictEqual(mixedNumbers.toString().search(/\.unshift\(/), -1, ''The <code>mixedNumbers</code> function should utilize the <code>unshift()</code> method'');' <add> testString: 'assert.notStrictEqual(mixedNumbers.toString().search(/\.unshift\(/), -1, "The <code>mixedNumbers</code> function should utilize the <code>unshift()</code> method");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.english.md <ide> We have defined a function, <code>htmlColorNames</code>, which takes an array of <ide> ```yml <ide> tests: <ide> - text: '<code>htmlColorNames</code> should return <code>["DarkSalmon", "BlanchedAlmond", "LavenderBlush", "PaleTurqoise", "FireBrick"]</code>' <del> testString: 'assert.deepEqual(htmlColorNames([''DarkGoldenRod'', ''WhiteSmoke'', ''LavenderBlush'', ''PaleTurqoise'', ''FireBrick'']), [''DarkSalmon'', ''BlanchedAlmond'', ''LavenderBlush'', ''PaleTurqoise'', ''FireBrick''], ''<code>htmlColorNames</code> should return <code>["DarkSalmon", "BlanchedAlmond", "LavenderBlush", "PaleTurqoise", "FireBrick"]</code>'');' <add> testString: 'assert.deepEqual(htmlColorNames(["DarkGoldenRod", "WhiteSmoke", "LavenderBlush", "PaleTurqoise", "FireBrick"]), ["DarkSalmon", "BlanchedAlmond", "LavenderBlush", "PaleTurqoise", "FireBrick"], "<code>htmlColorNames</code> should return <code>["DarkSalmon", "BlanchedAlmond", "LavenderBlush", "PaleTurqoise", "FireBrick"]</code>");' <ide> - text: The <code>htmlColorNames</code> function should utilize the <code>splice()</code> method <del> testString: 'assert(/.splice/.test(code), ''The <code>htmlColorNames</code> function should utilize the <code>splice()</code> method'');' <add> testString: 'assert(/.splice/.test(code), "The <code>htmlColorNames</code> function should utilize the <code>splice()</code> method");' <ide> - text: You should not use <code>shift()</code> or <code>unshift()</code>. <del> testString: 'assert(!/shift|unshift/.test(code), ''You should not use <code>shift()</code> or <code>unshift()</code>.'');' <add> testString: 'assert(!/shift|unshift/.test(code), "You should not use <code>shift()</code> or <code>unshift()</code>.");' <ide> - text: You should not use array bracket notation. <del> testString: 'assert(!/\[\d\]\s*=/.test(code), ''You should not use array bracket notation.'');' <add> testString: 'assert(!/\[\d\]\s*=/.test(code), "You should not use array bracket notation.");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```js <ide> function htmlColorNames(arr) { <ide> // change code below this line <del> <add> <ide> // change code above this line <ide> return arr; <del>} <del> <add>} <add> <ide> // do not change code below this line <ide> console.log(htmlColorNames(['DarkGoldenRod', 'WhiteSmoke', 'LavenderBlush', 'PaleTurqoise', 'FireBrick'])); <ide> ``` <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.english.md <ide> Using the same syntax, we can also <em><strong>add new</strong></em> key-value p <ide> ```yml <ide> tests: <ide> - text: <code>foods</code> is an object <del> testString: 'assert(typeof foods === ''object'', ''<code>foods</code> is an object'');' <add> testString: 'assert(typeof foods === "object", "<code>foods</code> is an object");' <ide> - text: The <code>foods</code> object has a key <code>"bananas"</code> with a value of <code>13</code> <del> testString: 'assert(foods.bananas === 13, ''The <code>foods</code> object has a key <code>"bananas"</code> with a value of <code>13</code>'');' <add> testString: 'assert(foods.bananas === 13, "The <code>foods</code> object has a key <code>"bananas"</code> with a value of <code>13</code>");' <ide> - text: The <code>foods</code> object has a key <code>"grapes"</code> with a value of <code>35</code> <del> testString: 'assert(foods.grapes === 35, ''The <code>foods</code> object has a key <code>"grapes"</code> with a value of <code>35</code>'');' <add> testString: 'assert(foods.grapes === 35, "The <code>foods</code> object has a key <code>"grapes"</code> with a value of <code>35</code>");' <ide> - text: The <code>foods</code> object has a key <code>"strawberries"</code> with a value of <code>27</code> <del> testString: 'assert(foods.strawberries === 27, ''The <code>foods</code> object has a key <code>"strawberries"</code> with a value of <code>27</code>'');' <add> testString: 'assert(foods.strawberries === 27, "The <code>foods</code> object has a key <code>"strawberries"</code> with a value of <code>27</code>");' <ide> - text: The key-value pairs should be set using dot or bracket notation <del> testString: 'assert(code.search(/bananas:/) === -1 && code.search(/grapes:/) === -1 && code.search(/strawberries:/) === -1, ''The key-value pairs should be set using dot or bracket notation'');' <add> testString: 'assert(code.search(/bananas:/) === -1 && code.search(/grapes:/) === -1 && code.search(/strawberries:/) === -1, "The key-value pairs should be set using dot or bracket notation");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/check-for-the-presence-of-an-element-with-indexof.english.md <ide> For example: <ide> ```yml <ide> tests: <ide> - text: '<code>quickCheck(["squash", "onions", "shallots"], "mushrooms")</code> should return <code>false</code>' <del> testString: 'assert.strictEqual(quickCheck([''squash'', ''onions'', ''shallots''], ''mushrooms''), false, ''<code>quickCheck(["squash", "onions", "shallots"], "mushrooms")</code> should return <code>false</code>'');' <add> testString: 'assert.strictEqual(quickCheck(["squash", "onions", "shallots"], "mushrooms"), false, "<code>quickCheck(["squash", "onions", "shallots"], "mushrooms")</code> should return <code>false</code>");' <ide> - text: '<code>quickCheck(["squash", "onions", "shallots"], "onions")</code> should return <code>true</code>' <del> testString: 'assert.strictEqual(quickCheck([''squash'', ''onions'', ''shallots''], ''onions''), true, ''<code>quickCheck(["squash", "onions", "shallots"], "onions")</code> should return <code>true</code>'');' <add> testString: 'assert.strictEqual(quickCheck(["squash", "onions", "shallots"], "onions"), true, "<code>quickCheck(["squash", "onions", "shallots"], "onions")</code> should return <code>true</code>");' <ide> - text: '<code>quickCheck([3, 5, 9, 125, 45, 2], 125)</code> should return <code>true</code>' <del> testString: 'assert.strictEqual(quickCheck([3, 5, 9, 125, 45, 2], 125), true, ''<code>quickCheck([3, 5, 9, 125, 45, 2], 125)</code> should return <code>true</code>'');' <add> testString: 'assert.strictEqual(quickCheck([3, 5, 9, 125, 45, 2], 125), true, "<code>quickCheck([3, 5, 9, 125, 45, 2], 125)</code> should return <code>true</code>");' <ide> - text: '<code>quickCheck([true, false, false], undefined)</code> should return <code>false</code>' <del> testString: 'assert.strictEqual(quickCheck([true, false, false], undefined), false, ''<code>quickCheck([true, false, false], undefined)</code> should return <code>false</code>'');' <add> testString: 'assert.strictEqual(quickCheck([true, false, false], undefined), false, "<code>quickCheck([true, false, false], undefined)</code> should return <code>false</code>");' <ide> - text: The <code>quickCheck</code> function should utilize the <code>indexOf()</code> method <del> testString: 'assert.notStrictEqual(quickCheck.toString().search(/\.indexOf\(/), -1, ''The <code>quickCheck</code> function should utilize the <code>indexOf()</code> method'');' <add> testString: 'assert.notStrictEqual(quickCheck.toString().search(/\.indexOf\(/), -1, "The <code>quickCheck</code> function should utilize the <code>indexOf()</code> method");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.english.md <ide> We've created an object, <code>users</code>, with some users in it and a functio <ide> ```yml <ide> tests: <ide> - text: 'The <code>users</code> object only contains the keys <code>Alan</code>, <code>Jeff</code>, <code>Sarah</code>, and <code>Ryan</code>' <del> testString: 'assert(''Alan'' in users && ''Jeff'' in users && ''Sarah'' in users && ''Ryan'' in users && Object.keys(users).length === 4, ''The <code>users</code> object only contains the keys <code>Alan</code>, <code>Jeff</code>, <code>Sarah</code>, and <code>Ryan</code>'');' <add> testString: 'assert("Alan" in users && "Jeff" in users && "Sarah" in users && "Ryan" in users && Object.keys(users).length === 4, "The <code>users</code> object only contains the keys <code>Alan</code>, <code>Jeff</code>, <code>Sarah</code>, and <code>Ryan</code>");' <ide> - text: 'The function <code>isEveryoneHere</code> returns <code>true</code> if <code>Alan</code>, <code>Jeff</code>, <code>Sarah</code>, and <code>Ryan</code> are properties on the <code>users</code> object' <del> testString: 'assert(isEveryoneHere(users) === true, ''The function <code>isEveryoneHere</code> returns <code>true</code> if <code>Alan</code>, <code>Jeff</code>, <code>Sarah</code>, and <code>Ryan</code> are properties on the <code>users</code> object'');' <add> testString: 'assert(isEveryoneHere(users) === true, "The function <code>isEveryoneHere</code> returns <code>true</code> if <code>Alan</code>, <code>Jeff</code>, <code>Sarah</code>, and <code>Ryan</code> are properties on the <code>users</code> object");' <ide> - text: 'The function <code>isEveryoneHere</code> returns <code>false</code> if <code>Alan</code>, <code>Jeff</code>, <code>Sarah</code>, and <code>Ryan</code> are not properties on the <code>users</code> object' <del> testString: 'assert((function() { delete users.Alan; delete users.Jeff; delete users.Sarah; delete users.Ryan; return isEveryoneHere(users) })() === false, ''The function <code>isEveryoneHere</code> returns <code>false</code> if <code>Alan</code>, <code>Jeff</code>, <code>Sarah</code>, and <code>Ryan</code> are not properties on the <code>users</code> object'');' <add> testString: 'assert((function() { delete users.Alan; delete users.Jeff; delete users.Sarah; delete users.Ryan; return isEveryoneHere(users) })() === false, "The function <code>isEveryoneHere</code> returns <code>false</code> if <code>Alan</code>, <code>Jeff</code>, <code>Sarah</code>, and <code>Ryan</code> are not properties on the <code>users</code> object");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/combine-arrays-with-the-spread-operator.english.md <ide> We have defined a function <code>spreadOut</code> that returns the variable <cod <ide> ```yml <ide> tests: <ide> - text: '<code>spreadOut</code> should return <code>["learning", "to", "code", "is", "fun"]</code>' <del> testString: 'assert.deepEqual(spreadOut(), [''learning'', ''to'', ''code'', ''is'', ''fun''], ''<code>spreadOut</code> should return <code>["learning", "to", "code", "is", "fun"]</code>'');' <add> testString: 'assert.deepEqual(spreadOut(), ["learning", "to", "code", "is", "fun"], "<code>spreadOut</code> should return <code>["learning", "to", "code", "is", "fun"]</code>");' <ide> - text: The <code>spreadOut</code> function should utilize spread syntax <del> testString: 'assert.notStrictEqual(spreadOut.toString().search(/[...]/), -1, ''The <code>spreadOut</code> function should utilize spread syntax'');' <add> testString: 'assert.notStrictEqual(spreadOut.toString().search(/[...]/), -1, "The <code>spreadOut</code> function should utilize spread syntax");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.english.md <ide> We have defined a function, <code>copyMachine</code> which takes <code>arr</code <ide> ```yml <ide> tests: <ide> - text: '<code>copyMachine([true, false, true], 2)</code> should return <code>[[true, false, true], [true, false, true]]</code>' <del> testString: 'assert.deepEqual(copyMachine([true, false, true], 2), [[true, false, true], [true, false, true]], ''<code>copyMachine([true, false, true], 2)</code> should return <code>[[true, false, true], [true, false, true]]</code>'');' <add> testString: 'assert.deepEqual(copyMachine([true, false, true], 2), [[true, false, true], [true, false, true]], "<code>copyMachine([true, false, true], 2)</code> should return <code>[[true, false, true], [true, false, true]]</code>");' <ide> - text: '<code>copyMachine([1, 2, 3], 5)</code> should return <code>[[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]]</code>' <del> testString: 'assert.deepEqual(copyMachine([1, 2, 3], 5), [[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]], ''<code>copyMachine([1, 2, 3], 5)</code> should return <code>[[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]]</code>'');' <add> testString: 'assert.deepEqual(copyMachine([1, 2, 3], 5), [[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]], "<code>copyMachine([1, 2, 3], 5)</code> should return <code>[[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]]</code>");' <ide> - text: '<code>copyMachine([true, true, null], 1)</code> should return <code>[[true, true, null]]</code>' <del> testString: 'assert.deepEqual(copyMachine([true, true, null], 1), [[true, true, null]], ''<code>copyMachine([true, true, null], 1)</code> should return <code>[[true, true, null]]</code>'');' <add> testString: 'assert.deepEqual(copyMachine([true, true, null], 1), [[true, true, null]], "<code>copyMachine([true, true, null], 1)</code> should return <code>[[true, true, null]]</code>");' <ide> - text: '<code>copyMachine(["it works"], 3)</code> should return <code>[["it works"], ["it works"], ["it works"]]</code>' <del> testString: 'assert.deepEqual(copyMachine([''it works''], 3), [[''it works''], [''it works''], [''it works'']], ''<code>copyMachine(["it works"], 3)</code> should return <code>[["it works"], ["it works"], ["it works"]]</code>'');' <add> testString: 'assert.deepEqual(copyMachine(["it works"], 3), [["it works"], ["it works"], ["it works"]], "<code>copyMachine(["it works"], 3)</code> should return <code>[["it works"], ["it works"], ["it works"]]</code>");' <ide> - text: The <code>copyMachine</code> function should utilize the <code>spread operator</code> with array <code>arr</code> <del> testString: 'assert.notStrictEqual(copyMachine.toString().indexOf(''.concat(_toConsumableArray(arr))''), -1, ''The <code>copyMachine</code> function should utilize the <code>spread operator</code> with array <code>arr</code>'');' <add> testString: 'assert.notStrictEqual(copyMachine.toString().indexOf(".concat(_toConsumableArray(arr))"), -1, "The <code>copyMachine</code> function should utilize the <code>spread operator</code> with array <code>arr</code>");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.english.md <ide> We have defined a function, <code>forecast</code>, that takes an array as an arg <ide> ```yml <ide> tests: <ide> - text: '<code>forecast</code> should return <code>["warm", "sunny"]' <del> testString: 'assert.deepEqual(forecast([''cold'', ''rainy'', ''warm'', ''sunny'', ''cool'', ''thunderstorms'']), [''warm'', ''sunny''], ''<code>forecast</code> should return <code>["warm", "sunny"]'');' <add> testString: 'assert.deepEqual(forecast(["cold", "rainy", "warm", "sunny", "cool", "thunderstorms"]), ["warm", "sunny"], "<code>forecast</code> should return <code>["warm", "sunny"]");' <ide> - text: The <code>forecast</code> function should utilize the <code>slice()</code> method <del> testString: 'assert(/\.slice\(/.test(code), ''The <code>forecast</code> function should utilize the <code>slice()</code> method'');' <add> testString: 'assert(/\.slice\(/.test(code), "The <code>forecast</code> function should utilize the <code>slice()</code> method");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```js <ide> function forecast(arr) { <ide> // change code below this line <del> <add> <ide> return arr; <ide> } <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.english.md <ide> We have defined a variable, <code>myNestedArray</code>, set equal to an array. M <ide> ```yml <ide> tests: <ide> - text: '<code>myNestedArray</code> should contain only numbers, booleans, and strings as data elements' <del> testString: 'assert.strictEqual((function(arr) { let flattened = (function flatten(arr) { const flat = [].concat(...arr); return flat.some (Array.isArray) ? flatten(flat) : flat; })(arr); for (let i = 0; i < flattened.length; i++) { if ( typeof flattened[i] !== ''number'' && typeof flattened[i] !== ''string'' && typeof flattened[i] !== ''boolean'') { return false } } return true })(myNestedArray), true, ''<code>myNestedArray</code> should contain only numbers, booleans, and strings as data elements'');' <add> testString: 'assert.strictEqual((function(arr) { let flattened = (function flatten(arr) { const flat = [].concat(...arr); return flat.some (Array.isArray) ? flatten(flat) : flat; })(arr); for (let i = 0; i < flattened.length; i++) { if ( typeof flattened[i] !== "number" && typeof flattened[i] !== "string" && typeof flattened[i] !== "boolean") { return false } } return true })(myNestedArray), true, "<code>myNestedArray</code> should contain only numbers, booleans, and strings as data elements");' <ide> - text: <code>myNestedArray</code> should have exactly 5 levels of depth <del> testString: 'assert.strictEqual((function(arr) {let depth = 0;function arrayDepth(array, i, d) { if (Array.isArray(array[i])) { arrayDepth(array[i], 0, d + 1);} else { depth = (d > depth) ? d : depth;}if (i < array.length) { arrayDepth(array, i + 1, d);} }arrayDepth(arr, 0, 0);return depth;})(myNestedArray), 4, ''<code>myNestedArray</code> should have exactly 5 levels of depth'');' <add> testString: 'assert.strictEqual((function(arr) {let depth = 0;function arrayDepth(array, i, d) { if (Array.isArray(array[i])) { arrayDepth(array[i], 0, d + 1);} else { depth = (d > depth) ? d : depth;}if (i < array.length) { arrayDepth(array, i + 1, d);} }arrayDepth(arr, 0, 0);return depth;})(myNestedArray), 4, "<code>myNestedArray</code> should have exactly 5 levels of depth");' <ide> - text: <code>myNestedArray</code> should contain exactly one occurrence of the string <code>"deep"</code> on an array nested 3 levels deep <del> testString: 'assert((function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, ''deep'').length === 1 && (function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, ''deep'')[0] === 2, ''<code>myNestedArray</code> should contain exactly one occurrence of the string <code>"deep"</code> on an array nested 3 levels deep'');' <add> testString: 'assert((function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, "deep").length === 1 && (function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, "deep")[0] === 2, "<code>myNestedArray</code> should contain exactly one occurrence of the string <code>"deep"</code> on an array nested 3 levels deep");' <ide> - text: <code>myNestedArray</code> should contain exactly one occurrence of the string <code>"deeper"</code> on an array nested 4 levels deep <del> testString: 'assert((function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, ''deeper'').length === 1 && (function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, ''deeper'')[0] === 3, ''<code>myNestedArray</code> should contain exactly one occurrence of the string <code>"deeper"</code> on an array nested 4 levels deep'');' <add> testString: 'assert((function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, "deeper").length === 1 && (function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, "deeper")[0] === 3, "<code>myNestedArray</code> should contain exactly one occurrence of the string <code>"deeper"</code> on an array nested 4 levels deep");' <ide> - text: <code>myNestedArray</code> should contain exactly one occurrence of the string <code>"deepest"</code> on an array nested 5 levels deep <del> testString: 'assert((function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, ''deepest'').length === 1 && (function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, ''deepest'')[0] === 4, ''<code>myNestedArray</code> should contain exactly one occurrence of the string <code>"deepest"</code> on an array nested 5 levels deep'');' <add> testString: 'assert((function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, "deepest").length === 1 && (function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, "deepest")[0] === 4, "<code>myNestedArray</code> should contain exactly one occurrence of the string <code>"deepest"</code> on an array nested 5 levels deep");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/generate-an-array-of-all-object-keys-with-object.keys.english.md <ide> Finish writing the <code>getArrayOfUsers</code> function so that it returns an a <ide> ```yml <ide> tests: <ide> - text: 'The <code>users</code> object only contains the keys <code>Alan</code>, <code>Jeff</code>, <code>Sarah</code>, and <code>Ryan</code>' <del> testString: 'assert(''Alan'' in users && ''Jeff'' in users && ''Sarah'' in users && ''Ryan'' in users && Object.keys(users).length === 4, ''The <code>users</code> object only contains the keys <code>Alan</code>, <code>Jeff</code>, <code>Sarah</code>, and <code>Ryan</code>'');' <add> testString: 'assert("Alan" in users && "Jeff" in users && "Sarah" in users && "Ryan" in users && Object.keys(users).length === 4, "The <code>users</code> object only contains the keys <code>Alan</code>, <code>Jeff</code>, <code>Sarah</code>, and <code>Ryan</code>");' <ide> - text: The <code>getArrayOfUsers</code> function returns an array which contains all the keys in the <code>users</code> object <del> testString: 'assert((function() { users.Sam = {}; users.Lewis = {}; let R = getArrayOfUsers(users); return (R.indexOf(''Alan'') !== -1 && R.indexOf(''Jeff'') !== -1 && R.indexOf(''Sarah'') !== -1 && R.indexOf(''Ryan'') !== -1 && R.indexOf(''Sam'') !== -1 && R.indexOf(''Lewis'') !== -1); })() === true, ''The <code>getArrayOfUsers</code> function returns an array which contains all the keys in the <code>users</code> object'');' <add> testString: 'assert((function() { users.Sam = {}; users.Lewis = {}; let R = getArrayOfUsers(users); return (R.indexOf("Alan") !== -1 && R.indexOf("Jeff") !== -1 && R.indexOf("Sarah") !== -1 && R.indexOf("Ryan") !== -1 && R.indexOf("Sam") !== -1 && R.indexOf("Lewis") !== -1); })() === true, "The <code>getArrayOfUsers</code> function returns an array which contains all the keys in the <code>users</code> object");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-all-an-arrays-items-using-for-loops.english.md <ide> We have defined a function, <code>filteredArray</code>, which takes <code>arr</c <ide> ```yml <ide> tests: <ide> - text: '<code>filteredArray([[10, 8, 3], [14, 6, 23], [3, 18, 6]], 18)</code> should return <code>[ [10, 8, 3], [14, 6, 23] ]</code>' <del> testString: 'assert.deepEqual(filteredArray([ [10, 8, 3], [14, 6, 23], [3, 18, 6] ], 18), [[10, 8, 3], [14, 6, 23]], ''<code>filteredArray([[10, 8, 3], [14, 6, 23], [3, 18, 6]], 18)</code> should return <code>[ [10, 8, 3], [14, 6, 23] ]</code>'');' <add> testString: 'assert.deepEqual(filteredArray([ [10, 8, 3], [14, 6, 23], [3, 18, 6] ], 18), [[10, 8, 3], [14, 6, 23]], "<code>filteredArray([[10, 8, 3], [14, 6, 23], [3, 18, 6]], 18)</code> should return <code>[ [10, 8, 3], [14, 6, 23] ]</code>");' <ide> - text: '<code>filteredArray([ ["trumpets", 2], ["flutes", 4], ["saxophones", 2] ], 2)</code> should return <code>[ ["flutes", 4] ]</code>' <del> testString: 'assert.deepEqual(filteredArray([ [''trumpets'', 2], [''flutes'', 4], [''saxophones'', 2] ], 2), [[''flutes'', 4]], ''<code>filteredArray([ ["trumpets", 2], ["flutes", 4], ["saxophones", 2] ], 2)</code> should return <code>[ ["flutes", 4] ]</code>'');' <add> testString: 'assert.deepEqual(filteredArray([ ["trumpets", 2], ["flutes", 4], ["saxophones", 2] ], 2), [["flutes", 4]], "<code>filteredArray([ ["trumpets", 2], ["flutes", 4], ["saxophones", 2] ], 2)</code> should return <code>[ ["flutes", 4] ]</code>");' <ide> - text: '<code>filteredArray([ ["amy", "beth", "sam"], ["dave", "sean", "peter"] ], "peter")</code> should return <code>[ ["amy", "beth", "sam"] ]</code>' <del> testString: 'assert.deepEqual(filteredArray([[''amy'', ''beth'', ''sam''], [''dave'', ''sean'', ''peter'']], ''peter''), [[''amy'', ''beth'', ''sam'']], ''<code>filteredArray([ ["amy", "beth", "sam"], ["dave", "sean", "peter"] ], "peter")</code> should return <code>[ ["amy", "beth", "sam"] ]</code>'');' <add> testString: 'assert.deepEqual(filteredArray([["amy", "beth", "sam"], ["dave", "sean", "peter"]], "peter"), [["amy", "beth", "sam"]], "<code>filteredArray([ ["amy", "beth", "sam"], ["dave", "sean", "peter"] ], "peter")</code> should return <code>[ ["amy", "beth", "sam"] ]</code>");' <ide> - text: '<code>filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3)</code> should return <code>[ ]</code>' <del> testString: 'assert.deepEqual(filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3), [], ''<code>filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3)</code> should return <code>[ ]</code>'');' <add> testString: 'assert.deepEqual(filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3), [], "<code>filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3)</code> should return <code>[ ]</code>");' <ide> - text: The <code>filteredArray</code> function should utilize a <code>for</code> loop <del> testString: 'assert.notStrictEqual(filteredArray.toString().search(/for/), -1, ''The <code>filteredArray</code> function should utilize a <code>for</code> loop'');' <add> testString: 'assert.notStrictEqual(filteredArray.toString().search(/for/), -1, "The <code>filteredArray</code> function should utilize a <code>for</code> loop");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-array-stored-in-an-object.english.md <ide> Take a look at the object we've provided in the code editor. The <code>user</cod <ide> ```yml <ide> tests: <ide> - text: 'The <code>user</code> object has <code>name</code>, <code>age</code>, and <code>data</code> keys' <del> testString: 'assert(''name'' in user && ''age'' in user && ''data'' in user, ''The <code>user</code> object has <code>name</code>, <code>age</code>, and <code>data</code> keys'');' <add> testString: 'assert("name" in user && "age" in user && "data" in user, "The <code>user</code> object has <code>name</code>, <code>age</code>, and <code>data</code> keys");' <ide> - text: The <code>addFriend</code> function accepts a <code>user</code> object and a <code>friend</code> string as arguments and adds the friend to the array of <code>friends</code> in the <code>user</code> object <del> testString: 'assert((function() { let L1 = user.data.friends.length; addFriend(user, ''Sean''); let L2 = user.data.friends.length; return (L2 === L1 + 1); })(), ''The <code>addFriend</code> function accepts a <code>user</code> object and a <code>friend</code> string as arguments and adds the friend to the array of <code>friends</code> in the <code>user</code> object'');' <add> testString: 'assert((function() { let L1 = user.data.friends.length; addFriend(user, "Sean"); let L2 = user.data.friends.length; return (L2 === L1 + 1); })(), "The <code>addFriend</code> function accepts a <code>user</code> object and a <code>friend</code> string as arguments and adds the friend to the array of <code>friends</code> in the <code>user</code> object");' <ide> - text: '<code>addFriend(user, "Pete")</code> should return <code>["Sam", "Kira", "Tomo", "Pete"]</code>' <del> testString: 'assert.deepEqual((function() { delete user.data.friends; user.data.friends = [''Sam'', ''Kira'', ''Tomo'']; return addFriend(user, ''Pete'') })(), [''Sam'', ''Kira'', ''Tomo'', ''Pete''], ''<code>addFriend(user, "Pete")</code> should return <code>["Sam", "Kira", "Tomo", "Pete"]</code>'');' <add> testString: 'assert.deepEqual((function() { delete user.data.friends; user.data.friends = ["Sam", "Kira", "Tomo"]; return addFriend(user, "Pete") })(), ["Sam", "Kira", "Tomo", "Pete"], "<code>addFriend(user, "Pete")</code> should return <code>["Sam", "Kira", "Tomo", "Pete"]</code>");' <ide> <ide> ``` <ide> <ide> let user = { <ide> }; <ide> <ide> function addFriend(userObj, friend) { <del> // change code below this line <add> // change code below this line <ide> <ide> // change code above this line <ide> } <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.english.md <ide> Here we've defined an object, <code>userActivity</code>, which includes another <ide> ```yml <ide> tests: <ide> - text: '<code>userActivity</code> has <code>id</code>, <code>date</code> and <code>data</code> properties' <del> testString: 'assert(''id'' in userActivity && ''date'' in userActivity && ''data'' in userActivity, ''<code>userActivity</code> has <code>id</code>, <code>date</code> and <code>data</code> properties'');' <add> testString: 'assert("id" in userActivity && "date" in userActivity && "data" in userActivity, "<code>userActivity</code> has <code>id</code>, <code>date</code> and <code>data</code> properties");' <ide> - text: <code>userActivity</code> has a <code>data</code> key set to an object with keys <code>totalUsers</code> and <code>online</code> <del> testString: 'assert(''totalUsers'' in userActivity.data && ''online'' in userActivity.data, ''<code>userActivity</code> has a <code>data</code> key set to an object with keys <code>totalUsers</code> and <code>online</code>'');' <add> testString: 'assert("totalUsers" in userActivity.data && "online" in userActivity.data, "<code>userActivity</code> has a <code>data</code> key set to an object with keys <code>totalUsers</code> and <code>online</code>");' <ide> - text: The <code>online</code> property nested in the <code>data</code> key of <code>userActivity</code> should be set to <code>45</code> <del> testString: 'assert(userActivity.data.online === 45, ''The <code>online</code> property nested in the <code>data</code> key of <code>userActivity</code> should be set to <code>45</code>'');' <add> testString: 'assert(userActivity.data.online === 45, "The <code>online</code> property nested in the <code>data</code> key of <code>userActivity</code> should be set to <code>45</code>");' <ide> - text: The <code>online</code> property is set using dot or bracket notation <del> testString: 'assert.strictEqual(code.search(/online: 45/), -1, ''The <code>online</code> property is set using dot or bracket notation'');' <add> testString: 'assert.strictEqual(code.search(/online: 45/), -1, "The <code>online</code> property is set using dot or bracket notation");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-from-an-array-with-pop-and-shift.english.md <ide> We have defined a function, <code>popShift</code>, which takes an array as an ar <ide> ```yml <ide> tests: <ide> - text: '<code>popShift(["challenge", "is", "not", "complete"])</code> should return <code>["challenge", "complete"]</code>' <del> testString: 'assert.deepEqual(popShift([''challenge'', ''is'', ''not'', ''complete'']), ["challenge", "complete"], ''<code>popShift(["challenge", "is", "not", "complete"])</code> should return <code>["challenge", "complete"]</code>'');' <add> testString: 'assert.deepEqual(popShift(["challenge", "is", "not", "complete"]), ["challenge", "complete"], "<code>popShift(["challenge", "is", "not", "complete"])</code> should return <code>["challenge", "complete"]</code>");' <ide> - text: The <code>popShift</code> function should utilize the <code>pop()</code> method <del> testString: 'assert.notStrictEqual(popShift.toString().search(/\.pop\(/), -1, ''The <code>popShift</code> function should utilize the <code>pop()</code> method'');' <add> testString: 'assert.notStrictEqual(popShift.toString().search(/\.pop\(/), -1, "The <code>popShift</code> function should utilize the <code>pop()</code> method");' <ide> - text: The <code>popShift</code> function should utilize the <code>shift()</code> method <del> testString: 'assert.notStrictEqual(popShift.toString().search(/\.shift\(/), -1, ''The <code>popShift</code> function should utilize the <code>shift()</code> method'');' <add> testString: 'assert.notStrictEqual(popShift.toString().search(/\.shift\(/), -1, "The <code>popShift</code> function should utilize the <code>shift()</code> method");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.english.md <ide> We've defined a function, <code>sumOfTen</code>, which takes an array as an argu <ide> ```yml <ide> tests: <ide> - text: <code>sumOfTen</code> should return 10 <del> testString: 'assert.strictEqual(sumOfTen([2, 5, 1, 5, 2, 1]), 10, ''<code>sumOfTen</code> should return 10'');' <add> testString: 'assert.strictEqual(sumOfTen([2, 5, 1, 5, 2, 1]), 10, "<code>sumOfTen</code> should return 10");' <ide> - text: The <code>sumOfTen</code> function should utilize the <code>splice()</code> method <del> testString: 'assert.notStrictEqual(sumOfTen.toString().search(/\.splice\(/), -1, ''The <code>sumOfTen</code> function should utilize the <code>splice()</code> method'');' <add> testString: 'assert.notStrictEqual(sumOfTen.toString().search(/\.splice\(/), -1, "The <code>sumOfTen</code> function should utilize the <code>splice()</code> method");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```js <ide> function sumOfTen(arr) { <ide> // change code below this line <del> <add> <ide> // change code above this line <ide> return arr.reduce((a, b) => a + b); <ide> } <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/use-an-array-to-store-a-collection-of-data.english.md <ide> We have defined a variable called <code>yourArray</code>. Complete the statement <ide> ```yml <ide> tests: <ide> - text: yourArray is an array <del> testString: 'assert.strictEqual(Array.isArray(yourArray), true, ''yourArray is an array'');' <add> testString: 'assert.strictEqual(Array.isArray(yourArray), true, "yourArray is an array");' <ide> - text: <code>yourArray</code> is at least 5 elements long <del> testString: 'assert.isAtLeast(yourArray.length, 5, ''<code>yourArray</code> is at least 5 elements long'');' <add> testString: 'assert.isAtLeast(yourArray.length, 5, "<code>yourArray</code> is at least 5 elements long");' <ide> - text: <code>yourArray</code> contains at least one <code>boolean</code> <del> testString: 'assert(yourArray.filter( el => typeof el === ''boolean'').length >= 1, ''<code>yourArray</code> contains at least one <code>boolean</code>'');' <add> testString: 'assert(yourArray.filter( el => typeof el === "boolean").length >= 1, "<code>yourArray</code> contains at least one <code>boolean</code>");' <ide> - text: <code>yourArray</code> contains at least one <code>number</code> <del> testString: 'assert(yourArray.filter( el => typeof el === ''number'').length >= 1, ''<code>yourArray</code> contains at least one <code>number</code>'');' <add> testString: 'assert(yourArray.filter( el => typeof el === "number").length >= 1, "<code>yourArray</code> contains at least one <code>number</code>");' <ide> - text: <code>yourArray</code> contains at least one <code>string</code> <del> testString: 'assert(yourArray.filter( el => typeof el === ''string'').length >= 1, ''<code>yourArray</code> contains at least one <code>string</code>'');' <add> testString: 'assert(yourArray.filter( el => typeof el === "string").length >= 1, "<code>yourArray</code> contains at least one <code>string</code>");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.english.md <ide> Use the delete keyword to remove the <code>oranges</code>, <code>plums</code>, a <ide> ```yml <ide> tests: <ide> - text: 'The <code>foods</code> object only has three keys: <code>apples</code>, <code>grapes</code>, and <code>bananas</code>' <del> testString: 'assert(!foods.hasOwnProperty(''oranges'') && !foods.hasOwnProperty(''plums'') && !foods.hasOwnProperty(''strawberries'') && Object.keys(foods).length === 3, ''The <code>foods</code> object only has three keys: <code>apples</code>, <code>grapes</code>, and <code>bananas</code>'');' <add> testString: 'assert(!foods.hasOwnProperty("oranges") && !foods.hasOwnProperty("plums") && !foods.hasOwnProperty("strawberries") && Object.keys(foods).length === 3, "The <code>foods</code> object only has three keys: <code>apples</code>, <code>grapes</code>, and <code>bananas</code>");' <ide> - text: 'The <code>oranges</code>, <code>plums</code>, and <code>strawberries</code> keys are removed using <code>delete</code>' <del> testString: 'assert(code.search(/oranges:/) !== -1 && code.search(/plums:/) !== -1 && code.search(/strawberries:/) !== -1, ''The <code>oranges</code>, <code>plums</code>, and <code>strawberries</code> keys are removed using <code>delete</code>'');' <add> testString: 'assert(code.search(/oranges:/) !== -1 && code.search(/plums:/) !== -1 && code.search(/strawberries:/) !== -1, "The <code>oranges</code>, <code>plums</code>, and <code>strawberries</code> keys are removed using <code>delete</code>");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.english.md <ide> Create a variable called <code>myData</code> and set it to equal the first value <ide> ```yml <ide> tests: <ide> - text: The variable <code>myData</code> should equal the first value of <code>myArray</code>. <del> testString: 'assert((function(){if(typeof myArray !== ''undefined'' && typeof myData !== ''undefined'' && myArray[0] === myData){return true;}else{return false;}})(), ''The variable <code>myData</code> should equal the first value of <code>myArray</code>.'');' <add> testString: 'assert((function(){if(typeof myArray !== "undefined" && typeof myData !== "undefined" && myArray[0] === myData){return true;}else{return false;}})(), "The variable <code>myData</code> should equal the first value of <code>myArray</code>.");' <ide> - text: The data in variable <code>myArray</code> should be accessed using bracket notation. <del> testString: 'assert((function(){if(code.match(/\s*=\s*myArray\[0\]/g)){return true;}else{return false;}})(), ''The data in variable <code>myArray</code> should be accessed using bracket notation.'');' <add> testString: 'assert((function(){if(code.match(/\s*=\s*myArray\[0\]/g)){return true;}else{return false;}})(), "The data in variable <code>myArray</code> should be accessed using bracket notation.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.english.md <ide> Using bracket notation select an element from <code>myArray</code> such that <co <ide> ```yml <ide> tests: <ide> - text: <code>myData</code> should be equal to <code>8</code>. <del> testString: 'assert(myData === 8, ''<code>myData</code> should be equal to <code>8</code>.'');' <add> testString: 'assert(myData === 8, "<code>myData</code> should be equal to <code>8</code>.");' <ide> - text: You should be using bracket notation to read the correct value from <code>myArray</code>. <del> testString: 'assert(/myArray\[2\]\[1\]/g.test(code) && !/myData\s*=\s*(?:.*[-+*/%]|\d)/g.test(code), ''You should be using bracket notation to read the correct value from <code>myArray</code>.'');' <add> testString: 'assert(/myArray\[2\]\[1\]/g.test(code) && !/myData\s*=\s*(?:.*[-+*/%]|\d)/g.test(code), "You should be using bracket notation to read the correct value from <code>myArray</code>.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.english.md <ide> Retrieve the second tree from the variable <code>myPlants</code> using object do <ide> ```yml <ide> tests: <ide> - text: <code>secondTree</code> should equal "pine" <del> testString: 'assert(secondTree === "pine", ''<code>secondTree</code> should equal "pine"'');' <add> testString: 'assert(secondTree === "pine", "<code>secondTree</code> should equal "pine"");' <ide> - text: Use dot and bracket notation to access <code>myPlants</code> <del> testString: 'assert(/=\s*myPlants\[1\].list\[1\]/.test(code), ''Use dot and bracket notation to access <code>myPlants</code>'');' <add> testString: 'assert(/=\s*myPlants\[1\].list\[1\]/.test(code), "Use dot and bracket notation to access <code>myPlants</code>");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```js <ide> // Setup <ide> var myPlants = [ <del> { <add> { <ide> type: "flowers", <ide> list: [ <ide> "rose", <ide> var myPlants = [ <ide> "pine", <ide> "birch" <ide> ] <del> } <add> } <ide> ]; <ide> <ide> // Only change code below this line <ide> console.info('after the test'); <ide> <ide> ```js <ide> var myPlants = [ <del> { <add> { <ide> type: "flowers", <ide> list: [ <ide> "rose", <ide> var myPlants = [ <ide> "pine", <ide> "birch" <ide> ] <del> } <add> } <ide> ]; <ide> <ide> // Only change code below this line <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-objects.english.md <ide> Access the <code>myStorage</code> object and assign the contents of the <code>gl <ide> ```yml <ide> tests: <ide> - text: <code>gloveBoxContents</code> should equal "maps" <del> testString: 'assert(gloveBoxContents === "maps", ''<code>gloveBoxContents</code> should equal "maps"'');' <add> testString: 'assert(gloveBoxContents === "maps", "<code>gloveBoxContents</code> should equal "maps"");' <ide> - text: Use dot and bracket notation to access <code>myStorage</code> <del> testString: 'assert(/=\s*myStorage\.car\.inside\[\s*("|'')glove box\1\s*\]/g.test(code), ''Use dot and bracket notation to access <code>myStorage</code>'');' <add> testString: 'assert(/=\s*myStorage\.car\.inside\[\s*("|")glove box\1\s*\]/g.test(code), "Use dot and bracket notation to access <code>myStorage</code>");' <ide> <ide> ``` <ide> <ide> console.info('after the test'); <ide> <ide> <ide> ```js <del>var myStorage = { <del> "car":{ <del> "inside":{ <add>var myStorage = { <add> "car":{ <add> "inside":{ <ide> "glove box":"maps", <ide> "passenger seat":"crumbs" <ide> }, <del> "outside":{ <add> "outside":{ <ide> "trunk":"jack" <ide> } <ide> } <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.english.md <ide> Read the values of the properties <code>"an entree"</code> and <code>"the drink" <ide> ```yml <ide> tests: <ide> - text: <code>entreeValue</code> should be a string <del> testString: 'assert(typeof entreeValue === ''string'' , ''<code>entreeValue</code> should be a string'');' <add> testString: 'assert(typeof entreeValue === "string" , "<code>entreeValue</code> should be a string");' <ide> - text: The value of <code>entreeValue</code> should be <code>"hamburger"</code> <del> testString: 'assert(entreeValue === ''hamburger'' , ''The value of <code>entreeValue</code> should be <code>"hamburger"</code>'');' <add> testString: 'assert(entreeValue === "hamburger" , "The value of <code>entreeValue</code> should be <code>"hamburger"</code>");' <ide> - text: <code>drinkValue</code> should be a string <del> testString: 'assert(typeof drinkValue === ''string'' , ''<code>drinkValue</code> should be a string'');' <add> testString: 'assert(typeof drinkValue === "string" , "<code>drinkValue</code> should be a string");' <ide> - text: The value of <code>drinkValue</code> should be <code>"water"</code> <del> testString: 'assert(drinkValue === ''water'' , ''The value of <code>drinkValue</code> should be <code>"water"</code>'');' <add> testString: 'assert(drinkValue === "water" , "The value of <code>drinkValue</code> should be <code>"water"</code>");' <ide> - text: You should use bracket notation twice <del> testString: 'assert(code.match(/testObj\s*?\[(''|")[^''"]+\1\]/g).length > 1, ''You should use bracket notation twice'');' <add> testString: 'assert(code.match(/testObj\s*?\[("|")[^""]+\1\]/g).length > 1, "You should use bracket notation twice");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.english.md <ide> Read in the property values of <code>testObj</code> using dot notation. Set the <ide> ```yml <ide> tests: <ide> - text: <code>hatValue</code> should be a string <del> testString: 'assert(typeof hatValue === ''string'' , ''<code>hatValue</code> should be a string'');' <add> testString: 'assert(typeof hatValue === "string" , "<code>hatValue</code> should be a string");' <ide> - text: The value of <code>hatValue</code> should be <code>"ballcap"</code> <del> testString: 'assert(hatValue === ''ballcap'' , ''The value of <code>hatValue</code> should be <code>"ballcap"</code>'');' <add> testString: 'assert(hatValue === "ballcap" , "The value of <code>hatValue</code> should be <code>"ballcap"</code>");' <ide> - text: <code>shirtValue</code> should be a string <del> testString: 'assert(typeof shirtValue === ''string'' , ''<code>shirtValue</code> should be a string'');' <add> testString: 'assert(typeof shirtValue === "string" , "<code>shirtValue</code> should be a string");' <ide> - text: The value of <code>shirtValue</code> should be <code>"jersey"</code> <del> testString: 'assert(shirtValue === ''jersey'' , ''The value of <code>shirtValue</code> should be <code>"jersey"</code>'');' <add> testString: 'assert(shirtValue === "jersey" , "The value of <code>shirtValue</code> should be <code>"jersey"</code>");' <ide> - text: You should use dot notation twice <del> testString: 'assert(code.match(/testObj\.\w+/g).length > 1, ''You should use dot notation twice'');' <add> testString: 'assert(code.match(/testObj\.\w+/g).length > 1, "You should use dot notation twice");' <ide> <ide> ``` <ide> <ide> var testObj = { <ide> "shoes": "cleats" <ide> }; <ide> <del>var hatValue = testObj.hat; <add>var hatValue = testObj.hat; <ide> var shirtValue = testObj.shirt; <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.english.md <ide> Use the <code>playerNumber</code> variable to look up player <code>16</code> in <ide> ```yml <ide> tests: <ide> - text: <code>playerNumber</code> should be a number <del> testString: 'assert(typeof playerNumber === ''number'', ''<code>playerNumber</code> should be a number'');' <add> testString: 'assert(typeof playerNumber === "number", "<code>playerNumber</code> should be a number");' <ide> - text: The variable <code>player</code> should be a string <del> testString: 'assert(typeof player === ''string'', ''The variable <code>player</code> should be a string'');' <add> testString: 'assert(typeof player === "string", "The variable <code>player</code> should be a string");' <ide> - text: The value of <code>player</code> should be "Montana" <del> testString: 'assert(player === ''Montana'', ''The value of <code>player</code> should be "Montana"'');' <add> testString: 'assert(player === "Montana", "The value of <code>player</code> should be "Montana"");' <ide> - text: You should use bracket notation to access <code>testObj</code> <del> testString: 'assert(/testObj\s*?\[.*?\]/.test(code),''You should use bracket notation to access <code>testObj</code>'');' <add> testString: 'assert(/testObj\s*?\[.*?\]/.test(code),"You should use bracket notation to access <code>testObj</code>");' <ide> - text: You should not assign the value <code>Montana</code> to the variable <code>player</code> directly. <del> testString: 'assert(!code.match(/player\s*=\s*"|\''\s*Montana\s*"|\''\s*;/gi),''You should not assign the value <code>Montana</code> to the variable <code>player</code> directly.'');' <add> testString: 'assert(!code.match(/player\s*=\s*"|\"\s*Montana\s*"|\"\s*;/gi),"You should not assign the value <code>Montana</code> to the variable <code>player</code> directly.");' <ide> - text: You should be using the variable <code>playerNumber</code> in your bracket notation <del> testString: 'assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code),''You should be using the variable <code>playerNumber</code> in your bracket notation'');' <add> testString: 'assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code),"You should be using the variable <code>playerNumber</code> in your bracket notation");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.english.md <ide> challengeType: 1 <ide> <section id='description'> <ide> You can add new properties to existing JavaScript objects the same way you would modify them. <ide> Here's how we would add a <code>"bark"</code> property to <code>ourDog</code>: <del><code>ourDog.bark = "bow-wow";</code> <add><code>ourDog.bark = "bow-wow";</code> <ide> or <ide> <code>ourDog["bark"] = "bow-wow";</code> <ide> Now when we evaluate <code>ourDog.bark</code>, we'll get his bark, "bow-wow". <ide> Add a <code>"bark"</code> property to <code>myDog</code> and set it to a dog sou <ide> ```yml <ide> tests: <ide> - text: Add the property <code>"bark"</code> to <code>myDog</code>. <del> testString: 'assert(myDog.bark !== undefined, ''Add the property <code>"bark"</code> to <code>myDog</code>.'');' <add> testString: 'assert(myDog.bark !== undefined, "Add the property <code>"bark"</code> to <code>myDog</code>.");' <ide> - text: Do not add <code>"bark"</code> to the setup section <del> testString: 'assert(!/bark[^\n]:/.test(code), ''Do not add <code>"bark"</code> to the setup section'');' <add> testString: 'assert(!/bark[^\n]:/.test(code), "Do not add <code>"bark"</code> to the setup section");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.english.md <ide> Change the <code>0</code> so that sum will equal <code>20</code>. <ide> ```yml <ide> tests: <ide> - text: <code>sum</code> should equal <code>20</code> <del> testString: 'assert(sum === 20, ''<code>sum</code> should equal <code>20</code>'');' <add> testString: 'assert(sum === 20, "<code>sum</code> should equal <code>20</code>");' <ide> - text: Use the <code>+</code> operator <del> testString: 'assert(/\+/.test(code), ''Use the <code>+</code> operator'');' <add> testString: 'assert(/\+/.test(code), "Use the <code>+</code> operator");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.english.md <ide> Write a switch statement to set <code>answer</code> for the following conditions <ide> ```yml <ide> tests: <ide> - text: <code>switchOfStuff("a")</code> should have a value of "apple" <del> testString: 'assert(switchOfStuff("a") === "apple", ''<code>switchOfStuff("a")</code> should have a value of "apple"'');' <add> testString: 'assert(switchOfStuff("a") === "apple", "<code>switchOfStuff("a")</code> should have a value of "apple"");' <ide> - text: <code>switchOfStuff("b")</code> should have a value of "bird" <del> testString: 'assert(switchOfStuff("b") === "bird", ''<code>switchOfStuff("b")</code> should have a value of "bird"'');' <add> testString: 'assert(switchOfStuff("b") === "bird", "<code>switchOfStuff("b")</code> should have a value of "bird"");' <ide> - text: <code>switchOfStuff("c")</code> should have a value of "cat" <del> testString: 'assert(switchOfStuff("c") === "cat", ''<code>switchOfStuff("c")</code> should have a value of "cat"'');' <add> testString: 'assert(switchOfStuff("c") === "cat", "<code>switchOfStuff("c")</code> should have a value of "cat"");' <ide> - text: <code>switchOfStuff("d")</code> should have a value of "stuff" <del> testString: 'assert(switchOfStuff("d") === "stuff", ''<code>switchOfStuff("d")</code> should have a value of "stuff"'');' <add> testString: 'assert(switchOfStuff("d") === "stuff", "<code>switchOfStuff("d")</code> should have a value of "stuff"");' <ide> - text: <code>switchOfStuff(4)</code> should have a value of "stuff" <del> testString: 'assert(switchOfStuff(4) === "stuff", ''<code>switchOfStuff(4)</code> should have a value of "stuff"'');' <add> testString: 'assert(switchOfStuff(4) === "stuff", "<code>switchOfStuff(4)</code> should have a value of "stuff"");' <ide> - text: You should not use any <code>if</code> or <code>else</code> statements <del> testString: 'assert(!/else/g.test(code) || !/if/g.test(code), ''You should not use any <code>if</code> or <code>else</code> statements'');' <add> testString: 'assert(!/else/g.test(code) || !/if/g.test(code), "You should not use any <code>if</code> or <code>else</code> statements");' <ide> - text: You should use a <code>default</code> statement <del> testString: 'assert(switchOfStuff("string-to-trigger-default-case") === "stuff", ''You should use a <code>default</code> statement'');' <add> testString: 'assert(switchOfStuff("string-to-trigger-default-case") === "stuff", "You should use a <code>default</code> statement");' <ide> - text: You should have at least 3 <code>break</code> statements <del> testString: 'assert(code.match(/break/g).length > 2, ''You should have at least 3 <code>break</code> statements'');' <add> testString: 'assert(code.match(/break/g).length > 2, "You should have at least 3 <code>break</code> statements");' <ide> <ide> ``` <ide> <ide> tests: <ide> function switchOfStuff(val) { <ide> var answer = ""; <ide> // Only change code below this line <del> <del> <del> <del> // Only change code above this line <del> return answer; <add> <add> <add> <add> // Only change code above this line <add> return answer; <ide> } <ide> <ide> // Change this value to test <ide> function switchOfStuff(val) { <ide> default: <ide> answer = "stuff"; <ide> } <del> return answer; <add> return answer; <ide> } <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.english.md <ide> Set <code>someAdjective</code> and append it to <code>myStr</code> using the <co <ide> ```yml <ide> tests: <ide> - text: <code>someAdjective</code> should be set to a string at least 3 characters long <del> testString: 'assert(typeof someAdjective !== ''undefined'' && someAdjective.length > 2, ''<code>someAdjective</code> should be set to a string at least 3 characters long'');' <add> testString: 'assert(typeof someAdjective !== "undefined" && someAdjective.length > 2, "<code>someAdjective</code> should be set to a string at least 3 characters long");' <ide> - text: Append <code>someAdjective</code> to <code>myStr</code> using the <code>+=</code> operator <del> testString: 'assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0, ''Append <code>someAdjective</code> to <code>myStr</code> using the <code>+=</code> operator'');' <add> testString: 'assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0, "Append <code>someAdjective</code> to <code>myStr</code> using the <code>+=</code> operator");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.english.md <ide> guideUrl: 'https://guide.freecodecamp.org/certificates/assignment-with-a-returne <ide> ## Description <ide> <section id='description'> <ide> If you'll recall from our discussion of <a href="javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator" target="_blank">Storing Values with the Assignment Operator</a>, everything to the right of the equal sign is resolved before the value is assigned. This means we can take the return value of a function and assign it to a variable. <del>Assume we have pre-defined a function <code>sum</code> which adds two numbers together, then: <add>Assume we have pre-defined a function <code>sum</code> which adds two numbers together, then: <ide> <code>ourSum = sum(5, 12);</code> <ide> will call <code>sum</code> function, which returns a value of <code>17</code> and assigns it to <code>ourSum</code> variable. <ide> </section> <ide> Call the <code>processArg</code> function with an argument of <code>7</code> and <ide> ```yml <ide> tests: <ide> - text: <code>processed</code> should have a value of <code>2</code> <del> testString: 'assert(processed === 2, ''<code>processed</code> should have a value of <code>2</code>'');' <add> testString: 'assert(processed === 2, "<code>processed</code> should have a value of <code>2</code>");' <ide> - text: You should assign <code>processArg</code> to <code>processed</code> <del> testString: 'assert(/processed\s*=\s*processArg\(\s*7\s*\)\s*;/.test(code), ''You should assign <code>processArg</code> to <code>processed</code>'');' <add> testString: 'assert(/processed\s*=\s*processArg\(\s*7\s*\)\s*;/.test(code), "You should assign <code>processArg</code> to <code>processed</code>");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.english.md <ide> You can set these object properties to whatever values you want, as long <code>" <ide> ```yml <ide> tests: <ide> - text: <code>myDog</code> should contain the property <code>name</code> and it should be a <code>string</code>. <del> testString: 'assert((function(z){if(z.hasOwnProperty("name") && z.name !== undefined && typeof z.name === "string"){return true;}else{return false;}})(myDog), ''<code>myDog</code> should contain the property <code>name</code> and it should be a <code>string</code>.'');' <add> testString: 'assert((function(z){if(z.hasOwnProperty("name") && z.name !== undefined && typeof z.name === "string"){return true;}else{return false;}})(myDog), "<code>myDog</code> should contain the property <code>name</code> and it should be a <code>string</code>.");' <ide> - text: <code>myDog</code> should contain the property <code>legs</code> and it should be a <code>number</code>. <del> testString: 'assert((function(z){if(z.hasOwnProperty("legs") && z.legs !== undefined && typeof z.legs === "number"){return true;}else{return false;}})(myDog), ''<code>myDog</code> should contain the property <code>legs</code> and it should be a <code>number</code>.'');' <add> testString: 'assert((function(z){if(z.hasOwnProperty("legs") && z.legs !== undefined && typeof z.legs === "number"){return true;}else{return false;}})(myDog), "<code>myDog</code> should contain the property <code>legs</code> and it should be a <code>number</code>.");' <ide> - text: <code>myDog</code> should contain the property <code>tails</code> and it should be a <code>number</code>. <del> testString: 'assert((function(z){if(z.hasOwnProperty("tails") && z.tails !== undefined && typeof z.tails === "number"){return true;}else{return false;}})(myDog), ''<code>myDog</code> should contain the property <code>tails</code> and it should be a <code>number</code>.'');' <add> testString: 'assert((function(z){if(z.hasOwnProperty("tails") && z.tails !== undefined && typeof z.tails === "number"){return true;}else{return false;}})(myDog), "<code>myDog</code> should contain the property <code>tails</code> and it should be a <code>number</code>.");' <ide> - text: <code>myDog</code> should contain the property <code>friends</code> and it should be an <code>array</code>. <del> testString: 'assert((function(z){if(z.hasOwnProperty("friends") && z.friends !== undefined && Array.isArray(z.friends)){return true;}else{return false;}})(myDog), ''<code>myDog</code> should contain the property <code>friends</code> and it should be an <code>array</code>.'');' <add> testString: 'assert((function(z){if(z.hasOwnProperty("friends") && z.friends !== undefined && Array.isArray(z.friends)){return true;}else{return false;}})(myDog), "<code>myDog</code> should contain the property <code>friends</code> and it should be an <code>array</code>.");' <ide> - text: <code>myDog</code> should only contain all the given properties. <del> testString: 'assert((function(z){return Object.keys(z).length === 4;})(myDog), ''<code>myDog</code> should only contain all the given properties.'');' <add> testString: 'assert((function(z){return Object.keys(z).length === 4;})(myDog), "<code>myDog</code> should only contain all the given properties.");' <ide> <ide> ``` <ide> <ide> var ourDog = { <ide> // Only change code below this line. <ide> <ide> var myDog = { <del> <del> <del> <del> <add> <add> <add> <add> <ide> }; <ide> ``` <ide> <ide> var myDog = { <ide> "name": "Camper", <ide> "legs": 4, <ide> "tails": 1, <del> "friends": ["everything!"] <add> "friends": ["everything!"] <ide> }; <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.english.md <ide> Write chained <code>if</code>/<code>else if</code> statements to fulfill the fol <ide> ```yml <ide> tests: <ide> - text: You should have at least four <code>else</code> statements <del> testString: 'assert(code.match(/else/g).length > 3, ''You should have at least four <code>else</code> statements'');' <add> testString: 'assert(code.match(/else/g).length > 3, "You should have at least four <code>else</code> statements");' <ide> - text: You should have at least four <code>if</code> statements <del> testString: 'assert(code.match(/if/g).length > 3, ''You should have at least four <code>if</code> statements'');' <add> testString: 'assert(code.match(/if/g).length > 3, "You should have at least four <code>if</code> statements");' <ide> - text: You should have at least one <code>return</code> statement <del> testString: 'assert(code.match(/return/g).length >= 1, ''You should have at least one <code>return</code> statement'');' <add> testString: 'assert(code.match(/return/g).length >= 1, "You should have at least one <code>return</code> statement");' <ide> - text: <code>testSize(0)</code> should return "Tiny" <del> testString: 'assert(testSize(0) === "Tiny", ''<code>testSize(0)</code> should return "Tiny"'');' <add> testString: 'assert(testSize(0) === "Tiny", "<code>testSize(0)</code> should return "Tiny"");' <ide> - text: <code>testSize(4)</code> should return "Tiny" <del> testString: 'assert(testSize(4) === "Tiny", ''<code>testSize(4)</code> should return "Tiny"'');' <add> testString: 'assert(testSize(4) === "Tiny", "<code>testSize(4)</code> should return "Tiny"");' <ide> - text: <code>testSize(5)</code> should return "Small" <del> testString: 'assert(testSize(5) === "Small", ''<code>testSize(5)</code> should return "Small"'');' <add> testString: 'assert(testSize(5) === "Small", "<code>testSize(5)</code> should return "Small"");' <ide> - text: <code>testSize(8)</code> should return "Small" <del> testString: 'assert(testSize(8) === "Small", ''<code>testSize(8)</code> should return "Small"'');' <add> testString: 'assert(testSize(8) === "Small", "<code>testSize(8)</code> should return "Small"");' <ide> - text: <code>testSize(10)</code> should return "Medium" <del> testString: 'assert(testSize(10) === "Medium", ''<code>testSize(10)</code> should return "Medium"'');' <add> testString: 'assert(testSize(10) === "Medium", "<code>testSize(10)</code> should return "Medium"");' <ide> - text: <code>testSize(14)</code> should return "Medium" <del> testString: 'assert(testSize(14) === "Medium", ''<code>testSize(14)</code> should return "Medium"'');' <add> testString: 'assert(testSize(14) === "Medium", "<code>testSize(14)</code> should return "Medium"");' <ide> - text: <code>testSize(15)</code> should return "Large" <del> testString: 'assert(testSize(15) === "Large", ''<code>testSize(15)</code> should return "Large"'');' <add> testString: 'assert(testSize(15) === "Large", "<code>testSize(15)</code> should return "Large"");' <ide> - text: <code>testSize(17)</code> should return "Large" <del> testString: 'assert(testSize(17) === "Large", ''<code>testSize(17)</code> should return "Large"'');' <add> testString: 'assert(testSize(17) === "Large", "<code>testSize(17)</code> should return "Large"");' <ide> - text: <code>testSize(20)</code> should return "Huge" <del> testString: 'assert(testSize(20) === "Huge", ''<code>testSize(20)</code> should return "Huge"'');' <add> testString: 'assert(testSize(20) === "Huge", "<code>testSize(20)</code> should return "Huge"");' <ide> - text: <code>testSize(25)</code> should return "Huge" <del> testString: 'assert(testSize(25) === "Huge", ''<code>testSize(25)</code> should return "Huge"'');' <add> testString: 'assert(testSize(25) === "Huge", "<code>testSize(25)</code> should return "Huge"");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```js <ide> function testSize(num) { <ide> // Only change code below this line <del> <del> <add> <add> <ide> return "Change Me"; <ide> // Only change code above this line <ide> } <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.english.md <ide> Try creating one of each type of comment. <ide> ```yml <ide> tests: <ide> - text: Create a <code>//</code> style comment that contains at least five letters. <del> testString: 'assert(code.match(/(\/\/)...../g), ''Create a <code>//</code> style comment that contains at least five letters.'');' <add> testString: 'assert(code.match(/(\/\/)...../g), "Create a <code>//</code> style comment that contains at least five letters.");' <ide> - text: Create a <code>/* */</code> style comment that contains at least five letters. <del> testString: 'assert(code.match(/(\/\*)([^\/]{5,})(?=\*\/)/gm), ''Create a <code>/* */</code> style comment that contains at least five letters.'');' <add> testString: 'assert(code.match(/(\/\*)([^\/]{5,})(?=\*\/)/gm), "Create a <code>/* */</code> style comment that contains at least five letters.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.english.md <ide> Add the <code>equality operator</code> to the indicated line so that the functio <ide> ```yml <ide> tests: <ide> - text: <code>testEqual(10)</code> should return "Not Equal" <del> testString: 'assert(testEqual(10) === "Not Equal", ''<code>testEqual(10)</code> should return "Not Equal"'');' <add> testString: 'assert(testEqual(10) === "Not Equal", "<code>testEqual(10)</code> should return "Not Equal"");' <ide> - text: <code>testEqual(12)</code> should return "Equal" <del> testString: 'assert(testEqual(12) === "Equal", ''<code>testEqual(12)</code> should return "Equal"'');' <add> testString: 'assert(testEqual(12) === "Equal", "<code>testEqual(12)</code> should return "Equal"");' <ide> - text: <code>testEqual("12")</code> should return "Equal" <del> testString: 'assert(testEqual("12") === "Equal", ''<code>testEqual("12")</code> should return "Equal"'');' <add> testString: 'assert(testEqual("12") === "Equal", "<code>testEqual("12")</code> should return "Equal"");' <ide> - text: You should use the <code>==</code> operator <del> testString: 'assert(code.match(/==/g) && !code.match(/===/g), ''You should use the <code>==</code> operator'');' <add> testString: 'assert(code.match(/==/g) && !code.match(/===/g), "You should use the <code>==</code> operator");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.english.md <ide> Add the <code>greater than</code> operator to the indicated lines so that the re <ide> ```yml <ide> tests: <ide> - text: <code>testGreaterThan(0)</code> should return "10 or Under" <del> testString: 'assert(testGreaterThan(0) === "10 or Under", ''<code>testGreaterThan(0)</code> should return "10 or Under"'');' <add> testString: 'assert(testGreaterThan(0) === "10 or Under", "<code>testGreaterThan(0)</code> should return "10 or Under"");' <ide> - text: <code>testGreaterThan(10)</code> should return "10 or Under" <del> testString: 'assert(testGreaterThan(10) === "10 or Under", ''<code>testGreaterThan(10)</code> should return "10 or Under"'');' <add> testString: 'assert(testGreaterThan(10) === "10 or Under", "<code>testGreaterThan(10)</code> should return "10 or Under"");' <ide> - text: <code>testGreaterThan(11)</code> should return "Over 10" <del> testString: 'assert(testGreaterThan(11) === "Over 10", ''<code>testGreaterThan(11)</code> should return "Over 10"'');' <add> testString: 'assert(testGreaterThan(11) === "Over 10", "<code>testGreaterThan(11)</code> should return "Over 10"");' <ide> - text: <code>testGreaterThan(99)</code> should return "Over 10" <del> testString: 'assert(testGreaterThan(99) === "Over 10", ''<code>testGreaterThan(99)</code> should return "Over 10"'');' <add> testString: 'assert(testGreaterThan(99) === "Over 10", "<code>testGreaterThan(99)</code> should return "Over 10"");' <ide> - text: <code>testGreaterThan(100)</code> should return "Over 10" <del> testString: 'assert(testGreaterThan(100) === "Over 10", ''<code>testGreaterThan(100)</code> should return "Over 10"'');' <add> testString: 'assert(testGreaterThan(100) === "Over 10", "<code>testGreaterThan(100)</code> should return "Over 10"");' <ide> - text: <code>testGreaterThan(101)</code> should return "Over 100" <del> testString: 'assert(testGreaterThan(101) === "Over 100", ''<code>testGreaterThan(101)</code> should return "Over 100"'');' <add> testString: 'assert(testGreaterThan(101) === "Over 100", "<code>testGreaterThan(101)</code> should return "Over 100"");' <ide> - text: <code>testGreaterThan(150)</code> should return "Over 100" <del> testString: 'assert(testGreaterThan(150) === "Over 100", ''<code>testGreaterThan(150)</code> should return "Over 100"'');' <add> testString: 'assert(testGreaterThan(150) === "Over 100", "<code>testGreaterThan(150)</code> should return "Over 100"");' <ide> - text: You should use the <code>&gt;</code> operator at least twice <del> testString: 'assert(code.match(/val\s*>\s*(''|")*\d+(''|")*/g).length > 1, ''You should use the <code>&gt;</code> operator at least twice'');' <add> testString: 'assert(code.match(/val\s*>\s*("|")*\d+("|")*/g).length > 1, "You should use the <code>&gt;</code> operator at least twice");' <ide> <ide> ``` <ide> <ide> function testGreaterThan(val) { <ide> if (val) { // Change this line <ide> return "Over 100"; <ide> } <del> <add> <ide> if (val) { // Change this line <ide> return "Over 10"; <ide> } <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.english.md <ide> Add the <code>greater than or equal to</code> operator to the indicated lines so <ide> ```yml <ide> tests: <ide> - text: <code>testGreaterOrEqual(0)</code> should return "Less than 10" <del> testString: 'assert(testGreaterOrEqual(0) === "Less than 10", ''<code>testGreaterOrEqual(0)</code> should return "Less than 10"'');' <add> testString: 'assert(testGreaterOrEqual(0) === "Less than 10", "<code>testGreaterOrEqual(0)</code> should return "Less than 10"");' <ide> - text: <code>testGreaterOrEqual(9)</code> should return "Less than 10" <del> testString: 'assert(testGreaterOrEqual(9) === "Less than 10", ''<code>testGreaterOrEqual(9)</code> should return "Less than 10"'');' <add> testString: 'assert(testGreaterOrEqual(9) === "Less than 10", "<code>testGreaterOrEqual(9)</code> should return "Less than 10"");' <ide> - text: <code>testGreaterOrEqual(10)</code> should return "10 or Over" <del> testString: 'assert(testGreaterOrEqual(10) === "10 or Over", ''<code>testGreaterOrEqual(10)</code> should return "10 or Over"'');' <add> testString: 'assert(testGreaterOrEqual(10) === "10 or Over", "<code>testGreaterOrEqual(10)</code> should return "10 or Over"");' <ide> - text: <code>testGreaterOrEqual(11)</code> should return "10 or Over" <del> testString: 'assert(testGreaterOrEqual(11) === "10 or Over", ''<code>testGreaterOrEqual(11)</code> should return "10 or Over"'');' <add> testString: 'assert(testGreaterOrEqual(11) === "10 or Over", "<code>testGreaterOrEqual(11)</code> should return "10 or Over"");' <ide> - text: <code>testGreaterOrEqual(19)</code> should return "10 or Over" <del> testString: 'assert(testGreaterOrEqual(19) === "10 or Over", ''<code>testGreaterOrEqual(19)</code> should return "10 or Over"'');' <add> testString: 'assert(testGreaterOrEqual(19) === "10 or Over", "<code>testGreaterOrEqual(19)</code> should return "10 or Over"");' <ide> - text: <code>testGreaterOrEqual(100)</code> should return "20 or Over" <del> testString: 'assert(testGreaterOrEqual(100) === "20 or Over", ''<code>testGreaterOrEqual(100)</code> should return "20 or Over"'');' <add> testString: 'assert(testGreaterOrEqual(100) === "20 or Over", "<code>testGreaterOrEqual(100)</code> should return "20 or Over"");' <ide> - text: <code>testGreaterOrEqual(21)</code> should return "20 or Over" <del> testString: 'assert(testGreaterOrEqual(21) === "20 or Over", ''<code>testGreaterOrEqual(21)</code> should return "20 or Over"'');' <add> testString: 'assert(testGreaterOrEqual(21) === "20 or Over", "<code>testGreaterOrEqual(21)</code> should return "20 or Over"");' <ide> - text: You should use the <code>&gt;=</code> operator at least twice <del> testString: 'assert(code.match(/val\s*>=\s*(''|")*\d+(''|")*/g).length > 1, ''You should use the <code>&gt;=</code> operator at least twice'');' <add> testString: 'assert(code.match(/val\s*>=\s*("|")*\d+("|")*/g).length > 1, "You should use the <code>&gt;=</code> operator at least twice");' <ide> <ide> ``` <ide> <ide> function testGreaterOrEqual(val) { <ide> if (val) { // Change this line <ide> return "20 or Over"; <ide> } <del> <add> <ide> if (val) { // Change this line <ide> return "10 or Over"; <ide> } <ide> function testGreaterOrEqual(val) { <ide> if (val >= 20) { // Change this line <ide> return "20 or Over"; <ide> } <del> <add> <ide> if (val >= 10) { // Change this line <ide> return "10 or Over"; <ide> } <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.english.md <ide> Add the inequality operator <code>!=</code> in the <code>if</code> statement so <ide> ```yml <ide> tests: <ide> - text: <code>testNotEqual(99)</code> should return "Equal" <del> testString: 'assert(testNotEqual(99) === "Equal", ''<code>testNotEqual(99)</code> should return "Equal"'');' <add> testString: 'assert(testNotEqual(99) === "Equal", "<code>testNotEqual(99)</code> should return "Equal"");' <ide> - text: <code>testNotEqual("99")</code> should return "Equal" <del> testString: 'assert(testNotEqual("99") === "Equal", ''<code>testNotEqual("99")</code> should return "Equal"'');' <add> testString: 'assert(testNotEqual("99") === "Equal", "<code>testNotEqual("99")</code> should return "Equal"");' <ide> - text: <code>testNotEqual(12)</code> should return "Not Equal" <del> testString: 'assert(testNotEqual(12) === "Not Equal", ''<code>testNotEqual(12)</code> should return "Not Equal"'');' <add> testString: 'assert(testNotEqual(12) === "Not Equal", "<code>testNotEqual(12)</code> should return "Not Equal"");' <ide> - text: <code>testNotEqual("12")</code> should return "Not Equal" <del> testString: 'assert(testNotEqual("12") === "Not Equal", ''<code>testNotEqual("12")</code> should return "Not Equal"'');' <add> testString: 'assert(testNotEqual("12") === "Not Equal", "<code>testNotEqual("12")</code> should return "Not Equal"");' <ide> - text: <code>testNotEqual("bob")</code> should return "Not Equal" <del> testString: 'assert(testNotEqual("bob") === "Not Equal", ''<code>testNotEqual("bob")</code> should return "Not Equal"'');' <add> testString: 'assert(testNotEqual("bob") === "Not Equal", "<code>testNotEqual("bob")</code> should return "Not Equal"");' <ide> - text: You should use the <code>!=</code> operator <del> testString: 'assert(code.match(/(?!!==)!=/), ''You should use the <code>!=</code> operator'');' <add> testString: 'assert(code.match(/(?!!==)!=/), "You should use the <code>!=</code> operator");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.english.md <ide> Add the <code>less than</code> operator to the indicated lines so that the retur <ide> ```yml <ide> tests: <ide> - text: <code>testLessThan(0)</code> should return "Under 25" <del> testString: 'assert(testLessThan(0) === "Under 25", ''<code>testLessThan(0)</code> should return "Under 25"'');' <add> testString: 'assert(testLessThan(0) === "Under 25", "<code>testLessThan(0)</code> should return "Under 25"");' <ide> - text: <code>testLessThan(24)</code> should return "Under 25" <del> testString: 'assert(testLessThan(24) === "Under 25", ''<code>testLessThan(24)</code> should return "Under 25"'');' <add> testString: 'assert(testLessThan(24) === "Under 25", "<code>testLessThan(24)</code> should return "Under 25"");' <ide> - text: <code>testLessThan(25)</code> should return "Under 55" <del> testString: 'assert(testLessThan(25) === "Under 55", ''<code>testLessThan(25)</code> should return "Under 55"'');' <add> testString: 'assert(testLessThan(25) === "Under 55", "<code>testLessThan(25)</code> should return "Under 55"");' <ide> - text: <code>testLessThan(54)</code> should return "Under 55" <del> testString: 'assert(testLessThan(54) === "Under 55", ''<code>testLessThan(54)</code> should return "Under 55"'');' <add> testString: 'assert(testLessThan(54) === "Under 55", "<code>testLessThan(54)</code> should return "Under 55"");' <ide> - text: <code>testLessThan(55)</code> should return "55 or Over" <del> testString: 'assert(testLessThan(55) === "55 or Over", ''<code>testLessThan(55)</code> should return "55 or Over"'');' <add> testString: 'assert(testLessThan(55) === "55 or Over", "<code>testLessThan(55)</code> should return "55 or Over"");' <ide> - text: <code>testLessThan(99)</code> should return "55 or Over" <del> testString: 'assert(testLessThan(99) === "55 or Over", ''<code>testLessThan(99)</code> should return "55 or Over"'');' <add> testString: 'assert(testLessThan(99) === "55 or Over", "<code>testLessThan(99)</code> should return "55 or Over"");' <ide> - text: You should use the <code>&lt;</code> operator at least twice <del> testString: 'assert(code.match(/val\s*<\s*(''|")*\d+(''|")*/g).length > 1, ''You should use the <code>&lt;</code> operator at least twice'');' <add> testString: 'assert(code.match(/val\s*<\s*("|")*\d+("|")*/g).length > 1, "You should use the <code>&lt;</code> operator at least twice");' <ide> <ide> ``` <ide> <ide> function testLessThan(val) { <ide> if (val) { // Change this line <ide> return "Under 25"; <ide> } <del> <add> <ide> if (val) { // Change this line <ide> return "Under 55"; <ide> } <ide> function testLessThan(val) { <ide> if (val < 25) { // Change this line <ide> return "Under 25"; <ide> } <del> <add> <ide> if (val < 55) { // Change this line <ide> return "Under 55"; <ide> } <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.english.md <ide> Add the <code>less than or equal to</code> operator to the indicated lines so th <ide> ```yml <ide> tests: <ide> - text: <code>testLessOrEqual(0)</code> should return "Smaller Than or Equal to 12" <del> testString: 'assert(testLessOrEqual(0) === "Smaller Than or Equal to 12", ''<code>testLessOrEqual(0)</code> should return "Smaller Than or Equal to 12"'');' <add> testString: 'assert(testLessOrEqual(0) === "Smaller Than or Equal to 12", "<code>testLessOrEqual(0)</code> should return "Smaller Than or Equal to 12"");' <ide> - text: <code>testLessOrEqual(11)</code> should return "Smaller Than or Equal to 12" <del> testString: 'assert(testLessOrEqual(11) === "Smaller Than or Equal to 12", ''<code>testLessOrEqual(11)</code> should return "Smaller Than or Equal to 12"'');' <add> testString: 'assert(testLessOrEqual(11) === "Smaller Than or Equal to 12", "<code>testLessOrEqual(11)</code> should return "Smaller Than or Equal to 12"");' <ide> - text: <code>testLessOrEqual(12)</code> should return "Smaller Than or Equal to 12" <del> testString: 'assert(testLessOrEqual(12) === "Smaller Than or Equal to 12", ''<code>testLessOrEqual(12)</code> should return "Smaller Than or Equal to 12"'');' <add> testString: 'assert(testLessOrEqual(12) === "Smaller Than or Equal to 12", "<code>testLessOrEqual(12)</code> should return "Smaller Than or Equal to 12"");' <ide> - text: <code>testLessOrEqual(23)</code> should return "Smaller Than or Equal to 24" <del> testString: 'assert(testLessOrEqual(23) === "Smaller Than or Equal to 24", ''<code>testLessOrEqual(23)</code> should return "Smaller Than or Equal to 24"'');' <add> testString: 'assert(testLessOrEqual(23) === "Smaller Than or Equal to 24", "<code>testLessOrEqual(23)</code> should return "Smaller Than or Equal to 24"");' <ide> - text: <code>testLessOrEqual(24)</code> should return "Smaller Than or Equal to 24" <del> testString: 'assert(testLessOrEqual(24) === "Smaller Than or Equal to 24", ''<code>testLessOrEqual(24)</code> should return "Smaller Than or Equal to 24"'');' <add> testString: 'assert(testLessOrEqual(24) === "Smaller Than or Equal to 24", "<code>testLessOrEqual(24)</code> should return "Smaller Than or Equal to 24"");' <ide> - text: <code>testLessOrEqual(25)</code> should return "More Than 24" <del> testString: 'assert(testLessOrEqual(25) === "More Than 24", ''<code>testLessOrEqual(25)</code> should return "More Than 24"'');' <add> testString: 'assert(testLessOrEqual(25) === "More Than 24", "<code>testLessOrEqual(25)</code> should return "More Than 24"");' <ide> - text: <code>testLessOrEqual(55)</code> should return "More Than 24" <del> testString: 'assert(testLessOrEqual(55) === "More Than 24", ''<code>testLessOrEqual(55)</code> should return "More Than 24"'');' <add> testString: 'assert(testLessOrEqual(55) === "More Than 24", "<code>testLessOrEqual(55)</code> should return "More Than 24"");' <ide> - text: You should use the <code>&lt;=</code> operator at least twice <del> testString: 'assert(code.match(/val\s*<=\s*(''|")*\d+(''|")*/g).length > 1, ''You should use the <code>&lt;=</code> operator at least twice'');' <add> testString: 'assert(code.match(/val\s*<=\s*("|")*\d+("|")*/g).length > 1, "You should use the <code>&lt;=</code> operator at least twice");' <ide> <ide> ``` <ide> <ide> function testLessOrEqual(val) { <ide> if (val) { // Change this line <ide> return "Smaller Than or Equal to 12"; <ide> } <del> <add> <ide> if (val) { // Change this line <ide> return "Smaller Than or Equal to 24"; <ide> } <ide> function testLessOrEqual(val) { <ide> if (val <= 12) { // Change this line <ide> return "Smaller Than or Equal to 12"; <ide> } <del> <add> <ide> if (val <= 24) { // Change this line <ide> return "Smaller Than or Equal to 24"; <ide> } <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.english.md <ide> Use the strict equality operator in the <code>if</code> statement so the functio <ide> ```yml <ide> tests: <ide> - text: <code>testStrict(10)</code> should return "Not Equal" <del> testString: 'assert(testStrict(10) === "Not Equal", ''<code>testStrict(10)</code> should return "Not Equal"'');' <add> testString: 'assert(testStrict(10) === "Not Equal", "<code>testStrict(10)</code> should return "Not Equal"");' <ide> - text: <code>testStrict(7)</code> should return "Equal" <del> testString: 'assert(testStrict(7) === "Equal", ''<code>testStrict(7)</code> should return "Equal"'');' <add> testString: 'assert(testStrict(7) === "Equal", "<code>testStrict(7)</code> should return "Equal"");' <ide> - text: <code>testStrict("7")</code> should return "Not Equal" <del> testString: 'assert(testStrict("7") === "Not Equal", ''<code>testStrict("7")</code> should return "Not Equal"'');' <add> testString: 'assert(testStrict("7") === "Not Equal", "<code>testStrict("7")</code> should return "Not Equal"");' <ide> - text: You should use the <code>===</code> operator <del> testString: 'assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0, ''You should use the <code>===</code> operator'');' <add> testString: 'assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0, "You should use the <code>===</code> operator");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.english.md <ide> Add the <code>strict inequality operator</code> to the <code>if</code> statement <ide> ```yml <ide> tests: <ide> - text: <code>testStrictNotEqual(17)</code> should return "Equal" <del> testString: 'assert(testStrictNotEqual(17) === "Equal", ''<code>testStrictNotEqual(17)</code> should return "Equal"'');' <add> testString: 'assert(testStrictNotEqual(17) === "Equal", "<code>testStrictNotEqual(17)</code> should return "Equal"");' <ide> - text: <code>testStrictNotEqual("17")</code> should return "Not Equal" <del> testString: 'assert(testStrictNotEqual("17") === "Not Equal", ''<code>testStrictNotEqual("17")</code> should return "Not Equal"'');' <add> testString: 'assert(testStrictNotEqual("17") === "Not Equal", "<code>testStrictNotEqual("17")</code> should return "Not Equal"");' <ide> - text: <code>testStrictNotEqual(12)</code> should return "Not Equal" <del> testString: 'assert(testStrictNotEqual(12) === "Not Equal", ''<code>testStrictNotEqual(12)</code> should return "Not Equal"'');' <add> testString: 'assert(testStrictNotEqual(12) === "Not Equal", "<code>testStrictNotEqual(12)</code> should return "Not Equal"");' <ide> - text: <code>testStrictNotEqual("bob")</code> should return "Not Equal" <del> testString: 'assert(testStrictNotEqual("bob") === "Not Equal", ''<code>testStrictNotEqual("bob")</code> should return "Not Equal"'');' <add> testString: 'assert(testStrictNotEqual("bob") === "Not Equal", "<code>testStrictNotEqual("bob")</code> should return "Not Equal"");' <ide> - text: You should use the <code>!==</code> operator <del> testString: 'assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0, ''You should use the <code>!==</code> operator'');' <add> testString: 'assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0, "You should use the <code>!==</code> operator");' <ide> <ide> ``` <ide> <ide> tests: <ide> // Setup <ide> function testStrictNotEqual(val) { <ide> // Only Change Code Below this Line <del> <add> <ide> if (val) { <ide> <ide> // Only Change Code Above this Line <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.english.md <ide> Combine the two if statements into one statement which will return <code>"Yes"</ <ide> ```yml <ide> tests: <ide> - text: You should use the <code>&&</code> operator once <del> testString: 'assert(code.match(/&&/g).length === 1, ''You should use the <code>&&</code> operator once'');' <add> testString: 'assert(code.match(/&&/g).length === 1, "You should use the <code>&&</code> operator once");' <ide> - text: You should only have one <code>if</code> statement <del> testString: 'assert(code.match(/if/g).length === 1, ''You should only have one <code>if</code> statement'');' <add> testString: 'assert(code.match(/if/g).length === 1, "You should only have one <code>if</code> statement");' <ide> - text: <code>testLogicalAnd(0)</code> should return "No" <del> testString: 'assert(testLogicalAnd(0) === "No", ''<code>testLogicalAnd(0)</code> should return "No"'');' <add> testString: 'assert(testLogicalAnd(0) === "No", "<code>testLogicalAnd(0)</code> should return "No"");' <ide> - text: <code>testLogicalAnd(24)</code> should return "No" <del> testString: 'assert(testLogicalAnd(24) === "No", ''<code>testLogicalAnd(24)</code> should return "No"'');' <add> testString: 'assert(testLogicalAnd(24) === "No", "<code>testLogicalAnd(24)</code> should return "No"");' <ide> - text: <code>testLogicalAnd(25)</code> should return "Yes" <del> testString: 'assert(testLogicalAnd(25) === "Yes", ''<code>testLogicalAnd(25)</code> should return "Yes"'');' <add> testString: 'assert(testLogicalAnd(25) === "Yes", "<code>testLogicalAnd(25)</code> should return "Yes"");' <ide> - text: <code>testLogicalAnd(30)</code> should return "Yes" <del> testString: 'assert(testLogicalAnd(30) === "Yes", ''<code>testLogicalAnd(30)</code> should return "Yes"'');' <add> testString: 'assert(testLogicalAnd(30) === "Yes", "<code>testLogicalAnd(30)</code> should return "Yes"");' <ide> - text: <code>testLogicalAnd(50)</code> should return "Yes" <del> testString: 'assert(testLogicalAnd(50) === "Yes", ''<code>testLogicalAnd(50)</code> should return "Yes"'');' <add> testString: 'assert(testLogicalAnd(50) === "Yes", "<code>testLogicalAnd(50)</code> should return "Yes"");' <ide> - text: <code>testLogicalAnd(51)</code> should return "No" <del> testString: 'assert(testLogicalAnd(51) === "No", ''<code>testLogicalAnd(51)</code> should return "No"'');' <add> testString: 'assert(testLogicalAnd(51) === "No", "<code>testLogicalAnd(51)</code> should return "No"");' <ide> - text: <code>testLogicalAnd(75)</code> should return "No" <del> testString: 'assert(testLogicalAnd(75) === "No", ''<code>testLogicalAnd(75)</code> should return "No"'');' <add> testString: 'assert(testLogicalAnd(75) === "No", "<code>testLogicalAnd(75)</code> should return "No"");' <ide> - text: <code>testLogicalAnd(80)</code> should return "No" <del> testString: 'assert(testLogicalAnd(80) === "No", ''<code>testLogicalAnd(80)</code> should return "No"'');' <add> testString: 'assert(testLogicalAnd(80) === "No", "<code>testLogicalAnd(80)</code> should return "No"");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.english.md <ide> Combine the two <code>if</code> statements into one statement which returns <cod <ide> ```yml <ide> tests: <ide> - text: You should use the <code>||</code> operator once <del> testString: 'assert(code.match(/\|\|/g).length === 1, ''You should use the <code>||</code> operator once'');' <add> testString: 'assert(code.match(/\|\|/g).length === 1, "You should use the <code>||</code> operator once");' <ide> - text: You should only have one <code>if</code> statement <del> testString: 'assert(code.match(/if/g).length === 1, ''You should only have one <code>if</code> statement'');' <add> testString: 'assert(code.match(/if/g).length === 1, "You should only have one <code>if</code> statement");' <ide> - text: <code>testLogicalOr(0)</code> should return "Outside" <del> testString: 'assert(testLogicalOr(0) === "Outside", ''<code>testLogicalOr(0)</code> should return "Outside"'');' <add> testString: 'assert(testLogicalOr(0) === "Outside", "<code>testLogicalOr(0)</code> should return "Outside"");' <ide> - text: <code>testLogicalOr(9)</code> should return "Outside" <del> testString: 'assert(testLogicalOr(9) === "Outside", ''<code>testLogicalOr(9)</code> should return "Outside"'');' <add> testString: 'assert(testLogicalOr(9) === "Outside", "<code>testLogicalOr(9)</code> should return "Outside"");' <ide> - text: <code>testLogicalOr(10)</code> should return "Inside" <del> testString: 'assert(testLogicalOr(10) === "Inside", ''<code>testLogicalOr(10)</code> should return "Inside"'');' <add> testString: 'assert(testLogicalOr(10) === "Inside", "<code>testLogicalOr(10)</code> should return "Inside"");' <ide> - text: <code>testLogicalOr(15)</code> should return "Inside" <del> testString: 'assert(testLogicalOr(15) === "Inside", ''<code>testLogicalOr(15)</code> should return "Inside"'');' <add> testString: 'assert(testLogicalOr(15) === "Inside", "<code>testLogicalOr(15)</code> should return "Inside"");' <ide> - text: <code>testLogicalOr(19)</code> should return "Inside" <del> testString: 'assert(testLogicalOr(19) === "Inside", ''<code>testLogicalOr(19)</code> should return "Inside"'');' <add> testString: 'assert(testLogicalOr(19) === "Inside", "<code>testLogicalOr(19)</code> should return "Inside"");' <ide> - text: <code>testLogicalOr(20)</code> should return "Inside" <del> testString: 'assert(testLogicalOr(20) === "Inside", ''<code>testLogicalOr(20)</code> should return "Inside"'');' <add> testString: 'assert(testLogicalOr(20) === "Inside", "<code>testLogicalOr(20)</code> should return "Inside"");' <ide> - text: <code>testLogicalOr(21)</code> should return "Outside" <del> testString: 'assert(testLogicalOr(21) === "Outside", ''<code>testLogicalOr(21)</code> should return "Outside"'');' <add> testString: 'assert(testLogicalOr(21) === "Outside", "<code>testLogicalOr(21)</code> should return "Outside"");' <ide> - text: <code>testLogicalOr(25)</code> should return "Outside" <del> testString: 'assert(testLogicalOr(25) === "Outside", ''<code>testLogicalOr(25)</code> should return "Outside"'');' <add> testString: 'assert(testLogicalOr(25) === "Outside", "<code>testLogicalOr(25)</code> should return "Outside"");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.english.md <ide> Convert the assignments for <code>a</code>, <code>b</code>, and <code>c</code> t <ide> ```yml <ide> tests: <ide> - text: <code>a</code> should equal <code>15</code> <del> testString: 'assert(a === 15, ''<code>a</code> should equal <code>15</code>'');' <add> testString: 'assert(a === 15, "<code>a</code> should equal <code>15</code>");' <ide> - text: <code>b</code> should equal <code>26</code> <del> testString: 'assert(b === 26, ''<code>b</code> should equal <code>26</code>'');' <add> testString: 'assert(b === 26, "<code>b</code> should equal <code>26</code>");' <ide> - text: <code>c</code> should equal <code>19</code> <del> testString: 'assert(c === 19, ''<code>c</code> should equal <code>19</code>'');' <add> testString: 'assert(c === 19, "<code>c</code> should equal <code>19</code>");' <ide> - text: You should use the <code>+=</code> operator for each variable <del> testString: 'assert(code.match(/\+=/g).length === 3, ''You should use the <code>+=</code> operator for each variable'');' <add> testString: 'assert(code.match(/\+=/g).length === 3, "You should use the <code>+=</code> operator for each variable");' <ide> - text: Do not modify the code above the line <del> testString: 'assert(/var a = 3;/.test(code) && /var b = 17;/.test(code) && /var c = 12;/.test(code), ''Do not modify the code above the line'');' <add> testString: 'assert(/var a = 3;/.test(code) && /var b = 17;/.test(code) && /var c = 12;/.test(code), "Do not modify the code above the line");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.english.md <ide> challengeType: 1 <ide> <section id='description'> <ide> The <code>/=</code> operator divides a variable by another number. <ide> <code>myVar = myVar / 5;</code> <del>Will divide <code>myVar</code> by <code>5</code>. This can be rewritten as: <add>Will divide <code>myVar</code> by <code>5</code>. This can be rewritten as: <ide> <code>myVar /= 5;</code> <ide> </section> <ide> <ide> Convert the assignments for <code>a</code>, <code>b</code>, and <code>c</code> t <ide> ```yml <ide> tests: <ide> - text: <code>a</code> should equal <code>4</code> <del> testString: 'assert(a === 4, ''<code>a</code> should equal <code>4</code>'');' <add> testString: 'assert(a === 4, "<code>a</code> should equal <code>4</code>");' <ide> - text: <code>b</code> should equal <code>27</code> <del> testString: 'assert(b === 27, ''<code>b</code> should equal <code>27</code>'');' <add> testString: 'assert(b === 27, "<code>b</code> should equal <code>27</code>");' <ide> - text: <code>c</code> should equal <code>3</code> <del> testString: 'assert(c === 3, ''<code>c</code> should equal <code>3</code>'');' <add> testString: 'assert(c === 3, "<code>c</code> should equal <code>3</code>");' <ide> - text: You should use the <code>/=</code> operator for each variable <del> testString: 'assert(code.match(/\/=/g).length === 3, ''You should use the <code>/=</code> operator for each variable'');' <add> testString: 'assert(code.match(/\/=/g).length === 3, "You should use the <code>/=</code> operator for each variable");' <ide> - text: Do not modify the code above the line <del> testString: 'assert(/var a = 48;/.test(code) && /var b = 108;/.test(code) && /var c = 33;/.test(code), ''Do not modify the code above the line'');' <add> testString: 'assert(/var a = 48;/.test(code) && /var b = 108;/.test(code) && /var c = 33;/.test(code), "Do not modify the code above the line");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.english.md <ide> challengeType: 1 <ide> <section id='description'> <ide> The <code>*=</code> operator multiplies a variable by a number. <ide> <code>myVar = myVar * 5;</code> <del>will multiply <code>myVar</code> by <code>5</code>. This can be rewritten as: <add>will multiply <code>myVar</code> by <code>5</code>. This can be rewritten as: <ide> <code>myVar *= 5;</code> <ide> </section> <ide> <ide> Convert the assignments for <code>a</code>, <code>b</code>, and <code>c</code> t <ide> ```yml <ide> tests: <ide> - text: <code>a</code> should equal <code>25</code> <del> testString: 'assert(a === 25, ''<code>a</code> should equal <code>25</code>'');' <add> testString: 'assert(a === 25, "<code>a</code> should equal <code>25</code>");' <ide> - text: <code>b</code> should equal <code>36</code> <del> testString: 'assert(b === 36, ''<code>b</code> should equal <code>36</code>'');' <add> testString: 'assert(b === 36, "<code>b</code> should equal <code>36</code>");' <ide> - text: <code>c</code> should equal <code>46</code> <del> testString: 'assert(c === 46, ''<code>c</code> should equal <code>46</code>'');' <add> testString: 'assert(c === 46, "<code>c</code> should equal <code>46</code>");' <ide> - text: You should use the <code>*=</code> operator for each variable <del> testString: 'assert(code.match(/\*=/g).length === 3, ''You should use the <code>*=</code> operator for each variable'');' <add> testString: 'assert(code.match(/\*=/g).length === 3, "You should use the <code>*=</code> operator for each variable");' <ide> - text: Do not modify the code above the line <del> testString: 'assert(/var a = 5;/.test(code) && /var b = 12;/.test(code) && /var c = 4\.6;/.test(code), ''Do not modify the code above the line'');' <add> testString: 'assert(/var a = 5;/.test(code) && /var b = 12;/.test(code) && /var c = 4\.6;/.test(code), "Do not modify the code above the line");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.english.md <ide> challengeType: 1 <ide> <section id='description'> <ide> Like the <code>+=</code> operator, <code>-=</code> subtracts a number from a variable. <ide> <code>myVar = myVar - 5;</code> <del>will subtract <code>5</code> from <code>myVar</code>. This can be rewritten as: <add>will subtract <code>5</code> from <code>myVar</code>. This can be rewritten as: <ide> <code>myVar -= 5;</code> <ide> </section> <ide> <ide> Convert the assignments for <code>a</code>, <code>b</code>, and <code>c</code> t <ide> ```yml <ide> tests: <ide> - text: <code>a</code> should equal <code>5</code> <del> testString: 'assert(a === 5, ''<code>a</code> should equal <code>5</code>'');' <add> testString: 'assert(a === 5, "<code>a</code> should equal <code>5</code>");' <ide> - text: <code>b</code> should equal <code>-6</code> <del> testString: 'assert(b === -6, ''<code>b</code> should equal <code>-6</code>'');' <add> testString: 'assert(b === -6, "<code>b</code> should equal <code>-6</code>");' <ide> - text: <code>c</code> should equal <code>2</code> <del> testString: 'assert(c === 2, ''<code>c</code> should equal <code>2</code>'');' <add> testString: 'assert(c === 2, "<code>c</code> should equal <code>2</code>");' <ide> - text: You should use the <code>-=</code> operator for each variable <del> testString: 'assert(code.match(/-=/g).length === 3, ''You should use the <code>-=</code> operator for each variable'');' <add> testString: 'assert(code.match(/-=/g).length === 3, "You should use the <code>-=</code> operator for each variable");' <ide> - text: Do not modify the code above the line <del> testString: 'assert(/var a = 11;/.test(code) && /var b = 9;/.test(code) && /var c = 3;/.test(code), ''Do not modify the code above the line'');' <add> testString: 'assert(/var a = 11;/.test(code) && /var b = 9;/.test(code) && /var c = 3;/.test(code), "Do not modify the code above the line");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.english.md <ide> Build <code>myStr</code> from the strings <code>"This is the start. "</code> and <ide> ```yml <ide> tests: <ide> - text: <code>myStr</code> should have a value of <code>This is the start. This is the end.</code> <del> testString: 'assert(myStr === "This is the start. This is the end.", ''<code>myStr</code> should have a value of <code>This is the start. This is the end.</code>'');' <add> testString: 'assert(myStr === "This is the start. This is the end.", "<code>myStr</code> should have a value of <code>This is the start. This is the end.</code>");' <ide> - text: Use the <code>+</code> operator to build <code>myStr</code> <del> testString: 'assert(code.match(/(["'']).*(["''])\s*\+\s*(["'']).*(["''])/g).length > 1, ''Use the <code>+</code> operator to build <code>myStr</code>'');' <add> testString: 'assert(code.match(/([""]).*([""])\s*\+\s*([""]).*([""])/g).length > 1, "Use the <code>+</code> operator to build <code>myStr</code>");' <ide> - text: <code>myStr</code> should be created using the <code>var</code> keyword. <del> testString: 'assert(/var\s+myStr/.test(code), ''<code>myStr</code> should be created using the <code>var</code> keyword.'');' <add> testString: 'assert(/var\s+myStr/.test(code), "<code>myStr</code> should be created using the <code>var</code> keyword.");' <ide> - text: Make sure to assign the result to the <code>myStr</code> variable. <del> testString: 'assert(/myStr\s*=/.test(code), ''Make sure to assign the result to the <code>myStr</code> variable.'');' <add> testString: 'assert(/myStr\s*=/.test(code), "Make sure to assign the result to the <code>myStr</code> variable.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.english.md <ide> Build <code>myStr</code> over several lines by concatenating these two strings: <ide> ```yml <ide> tests: <ide> - text: <code>myStr</code> should have a value of <code>This is the first sentence. This is the second sentence.</code> <del> testString: 'assert(myStr === "This is the first sentence. This is the second sentence.", ''<code>myStr</code> should have a value of <code>This is the first sentence. This is the second sentence.</code>'');' <add> testString: 'assert(myStr === "This is the first sentence. This is the second sentence.", "<code>myStr</code> should have a value of <code>This is the first sentence. This is the second sentence.</code>");' <ide> - text: Use the <code>+=</code> operator to build <code>myStr</code> <del> testString: 'assert(code.match(/\w\s*\+=\s*["'']/g).length > 1 && code.match(/\w\s*\=\s*["'']/g).length > 1, ''Use the <code>+=</code> operator to build <code>myStr</code>'');' <add> testString: 'assert(code.match(/\w\s*\+=\s*[""]/g).length > 1 && code.match(/\w\s*\=\s*[""]/g).length > 1, "Use the <code>+=</code> operator to build <code>myStr</code>");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.english.md <ide> Set <code>myName</code> to a string equal to your name and build <code>myStr</co <ide> ```yml <ide> tests: <ide> - text: <code>myName</code> should be set to a string at least 3 characters long <del> testString: 'assert(typeof myName !== ''undefined'' && myName.length > 2, ''<code>myName</code> should be set to a string at least 3 characters long'');' <add> testString: 'assert(typeof myName !== "undefined" && myName.length > 2, "<code>myName</code> should be set to a string at least 3 characters long");' <ide> - text: Use two <code>+</code> operators to build <code>myStr</code> with <code>myName</code> inside it <del> testString: 'assert(code.match(/["'']\s*\+\s*myName\s*\+\s*["'']/g).length > 0, ''Use two <code>+</code> operators to build <code>myStr</code> with <code>myName</code> inside it'');' <add> testString: 'assert(code.match(/[""]\s*\+\s*myName\s*\+\s*[""]/g).length > 0, "Use two <code>+</code> operators to build <code>myStr</code> with <code>myName</code> inside it");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.english.md <ide> Push the odd numbers from 9 through 1 to <code>myArray</code> using a <code>for< <ide> ```yml <ide> tests: <ide> - text: You should be using a <code>for</code> loop for this. <del> testString: 'assert(code.match(/for\s*\(/g).length > 1, ''You should be using a <code>for</code> loop for this.'');' <add> testString: 'assert(code.match(/for\s*\(/g).length > 1, "You should be using a <code>for</code> loop for this.");' <ide> - text: You should be using the array method <code>push</code>. <del> testString: 'assert(code.match(/myArray.push/), ''You should be using the array method <code>push</code>.'');' <add> testString: 'assert(code.match(/myArray.push/), "You should be using the array method <code>push</code>.");' <ide> - text: '<code>myArray</code> should equal <code>[9,7,5,3,1]</code>.' <del> testString: 'assert.deepEqual(myArray, [9,7,5,3,1], ''<code>myArray</code> should equal <code>[9,7,5,3,1]</code>.'');' <add> testString: 'assert.deepEqual(myArray, [9,7,5,3,1], "<code>myArray</code> should equal <code>[9,7,5,3,1]</code>.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.english.md <ide> You will write a card counting function. It will receive a <code>card</code> par <ide> ```yml <ide> tests: <ide> - text: 'Cards Sequence 2, 3, 4, 5, 6 should return <code>5 Bet</code>' <del> testString: 'assert((function(){ count = 0; cc(2);cc(3);cc(4);cc(5);var out = cc(6); if(out === "5 Bet") {return true;} return false; })(), ''Cards Sequence 2, 3, 4, 5, 6 should return <code>5 Bet</code>'');' <add> testString: 'assert((function(){ count = 0; cc(2);cc(3);cc(4);cc(5);var out = cc(6); if(out === "5 Bet") {return true;} return false; })(), "Cards Sequence 2, 3, 4, 5, 6 should return <code>5 Bet</code>");' <ide> - text: 'Cards Sequence 7, 8, 9 should return <code>0 Hold</code>' <del> testString: 'assert((function(){ count = 0; cc(7);cc(8);var out = cc(9); if(out === "0 Hold") {return true;} return false; })(), ''Cards Sequence 7, 8, 9 should return <code>0 Hold</code>'');' <add> testString: 'assert((function(){ count = 0; cc(7);cc(8);var out = cc(9); if(out === "0 Hold") {return true;} return false; })(), "Cards Sequence 7, 8, 9 should return <code>0 Hold</code>");' <ide> - text: 'Cards Sequence 10, J, Q, K, A should return <code>-5 Hold</code>' <del> testString: 'assert((function(){ count = 0; cc(10);cc(''J'');cc(''Q'');cc(''K'');var out = cc(''A''); if(out === "-5 Hold") {return true;} return false; })(), ''Cards Sequence 10, J, Q, K, A should return <code>-5 Hold</code>'');' <add> testString: 'assert((function(){ count = 0; cc(10);cc("J");cc("Q");cc("K");var out = cc("A"); if(out === "-5 Hold") {return true;} return false; })(), "Cards Sequence 10, J, Q, K, A should return <code>-5 Hold</code>");' <ide> - text: 'Cards Sequence 3, 7, Q, 8, A should return <code>-1 Hold</code>' <del> testString: 'assert((function(){ count = 0; cc(3);cc(7);cc(''Q'');cc(8);var out = cc(''A''); if(out === "-1 Hold") {return true;} return false; })(), ''Cards Sequence 3, 7, Q, 8, A should return <code>-1 Hold</code>'');' <add> testString: 'assert((function(){ count = 0; cc(3);cc(7);cc("Q");cc(8);var out = cc("A"); if(out === "-1 Hold") {return true;} return false; })(), "Cards Sequence 3, 7, Q, 8, A should return <code>-1 Hold</code>");' <ide> - text: 'Cards Sequence 2, J, 9, 2, 7 should return <code>1 Bet</code>' <del> testString: 'assert((function(){ count = 0; cc(2);cc(''J'');cc(9);cc(2);var out = cc(7); if(out === "1 Bet") {return true;} return false; })(), ''Cards Sequence 2, J, 9, 2, 7 should return <code>1 Bet</code>'');' <add> testString: 'assert((function(){ count = 0; cc(2);cc("J");cc(9);cc(2);var out = cc(7); if(out === "1 Bet") {return true;} return false; })(), "Cards Sequence 2, J, 9, 2, 7 should return <code>1 Bet</code>");' <ide> - text: 'Cards Sequence 2, 2, 10 should return <code>1 Bet</code>' <del> testString: 'assert((function(){ count = 0; cc(2);cc(2);var out = cc(10); if(out === "1 Bet") {return true;} return false; })(), ''Cards Sequence 2, 2, 10 should return <code>1 Bet</code>'');' <add> testString: 'assert((function(){ count = 0; cc(2);cc(2);var out = cc(10); if(out === "1 Bet") {return true;} return false; })(), "Cards Sequence 2, 2, 10 should return <code>1 Bet</code>");' <ide> - text: 'Cards Sequence 3, 2, A, 10, K should return <code>-1 Hold</code>' <del> testString: 'assert((function(){ count = 0; cc(3);cc(2);cc(''A'');cc(10);var out = cc(''K''); if(out === "-1 Hold") {return true;} return false; })(), ''Cards Sequence 3, 2, A, 10, K should return <code>-1 Hold</code>'');' <add> testString: 'assert((function(){ count = 0; cc(3);cc(2);cc("A");cc(10);var out = cc("K"); if(out === "-1 Hold") {return true;} return false; })(), "Cards Sequence 3, 2, A, 10, K should return <code>-1 Hold</code>");' <ide> <ide> ``` <ide> <ide> var count = 0; <ide> <ide> function cc(card) { <ide> // Only change code below this line <del> <del> <add> <add> <ide> return "Change Me"; <ide> // Only change code above this line <ide> } <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.english.md <ide> Create a variable <code>myDecimal</code> and give it a decimal value with a frac <ide> ```yml <ide> tests: <ide> - text: <code>myDecimal</code> should be a number. <del> testString: 'assert(typeof myDecimal === "number", ''<code>myDecimal</code> should be a number.'');' <add> testString: 'assert(typeof myDecimal === "number", "<code>myDecimal</code> should be a number.");' <ide> - text: <code>myDecimal</code> should have a decimal point <del> testString: 'assert(myDecimal % 1 != 0, ''<code>myDecimal</code> should have a decimal point''); ' <add> testString: 'assert(myDecimal % 1 != 0, "<code>myDecimal</code> should have a decimal point"); ' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.english.md <ide> Use the <code>var</code> keyword to create a variable called <code>myName</code> <ide> ```yml <ide> tests: <ide> - text: 'You should declare <code>myName</code> with the <code>var</code> keyword, ending with a semicolon' <del> testString: 'assert(/var\s+myName\s*;/.test(code), ''You should declare <code>myName</code> with the <code>var</code> keyword, ending with a semicolon'');' <add> testString: 'assert(/var\s+myName\s*;/.test(code), "You should declare <code>myName</code> with the <code>var</code> keyword, ending with a semicolon");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/declare-string-variables.english.md <ide> Create two new <code>string</code> variables: <code>myFirstName</code> and <code <ide> ```yml <ide> tests: <ide> - text: <code>myFirstName</code> should be a string with at least one character in it. <del> testString: 'assert((function(){if(typeof myFirstName !== "undefined" && typeof myFirstName === "string" && myFirstName.length > 0){return true;}else{return false;}})(), ''<code>myFirstName</code> should be a string with at least one character in it.'');' <add> testString: 'assert((function(){if(typeof myFirstName !== "undefined" && typeof myFirstName === "string" && myFirstName.length > 0){return true;}else{return false;}})(), "<code>myFirstName</code> should be a string with at least one character in it.");' <ide> - text: <code>myLastName</code> should be a string with at least one character in it. <del> testString: 'assert((function(){if(typeof myLastName !== "undefined" && typeof myLastName === "string" && myLastName.length > 0){return true;}else{return false;}})(), ''<code>myLastName</code> should be a string with at least one character in it.'');' <add> testString: 'assert((function(){if(typeof myLastName !== "undefined" && typeof myLastName === "string" && myLastName.length > 0){return true;}else{return false;}})(), "<code>myLastName</code> should be a string with at least one character in it.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.english.md <ide> Change the code to use the <code>--</code> operator on <code>myVar</code>. <ide> ```yml <ide> tests: <ide> - text: <code>myVar</code> should equal <code>10</code> <del> testString: 'assert(myVar === 10, ''<code>myVar</code> should equal <code>10</code>'');' <add> testString: 'assert(myVar === 10, "<code>myVar</code> should equal <code>10</code>");' <ide> - text: <code>myVar = myVar - 1;</code> should be changed <del> testString: 'assert(/var\s*myVar\s*=\s*11;\s*\/*.*\s*([-]{2}\s*myVar|myVar\s*[-]{2});/.test(code), ''<code>myVar = myVar - 1;</code> should be changed'');' <add> testString: 'assert(/var\s*myVar\s*=\s*11;\s*\/*.*\s*([-]{2}\s*myVar|myVar\s*[-]{2});/.test(code), "<code>myVar = myVar - 1;</code> should be changed");' <ide> - text: Use the <code>--</code> operator on <code>myVar</code> <del> testString: 'assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code), ''Use the <code>--</code> operator on <code>myVar</code>'');' <add> testString: 'assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code), "Use the <code>--</code> operator on <code>myVar</code>");' <ide> - text: Do not change code above the line <del> testString: 'assert(/var myVar = 11;/.test(code), ''Do not change code above the line'');' <add> testString: 'assert(/var myVar = 11;/.test(code), "Do not change code above the line");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.english.md <ide> Delete the <code>"tails"</code> property from <code>myDog</code>. You may use ei <ide> ```yml <ide> tests: <ide> - text: Delete the property <code>"tails"</code> from <code>myDog</code>. <del> testString: 'assert(typeof myDog === "object" && myDog.tails === undefined, ''Delete the property <code>"tails"</code> from <code>myDog</code>.'');' <add> testString: 'assert(typeof myDog === "object" && myDog.tails === undefined, "Delete the property <code>"tails"</code> from <code>myDog</code>.");' <ide> - text: Do not modify the <code>myDog</code> setup <del> testString: 'assert(code.match(/"tails": 1/g).length > 1, ''Do not modify the <code>myDog</code> setup'');' <add> testString: 'assert(code.match(/"tails": 1/g).length > 1, "Do not modify the <code>myDog</code> setup");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.english.md <ide> Change the <code>0.0</code> so that <code>quotient</code> will equal to <code>2. <ide> ```yml <ide> tests: <ide> - text: The variable <code>quotient</code> should equal <code>2.2</code> <del> testString: 'assert(quotient === 2.2, ''The variable <code>quotient</code> should equal <code>2.2</code>'');' <add> testString: 'assert(quotient === 2.2, "The variable <code>quotient</code> should equal <code>2.2</code>");' <ide> - text: You should use the <code>/</code> operator to divide 4.4 by 2 <del> testString: 'assert(/4\.40*\s*\/\s*2\.*0*/.test(code), ''You should use the <code>/</code> operator to divide 4.4 by 2'');' <add> testString: 'assert(/4\.40*\s*\/\s*2\.*0*/.test(code), "You should use the <code>/</code> operator to divide 4.4 by 2");' <ide> - text: The quotient variable should only be assigned once <del> testString: 'assert(code.match(/quotient/g).length === 1, ''The quotient variable should only be assigned once'');' <add> testString: 'assert(code.match(/quotient/g).length === 1, "The quotient variable should only be assigned once");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.english.md <ide> Change the <code>0</code> so that the <code>quotient</code> is equal to <code>2< <ide> ```yml <ide> tests: <ide> - text: Make the variable <code>quotient</code> equal to 2. <del> testString: 'assert(quotient === 2, ''Make the variable <code>quotient</code> equal to 2.'');' <add> testString: 'assert(quotient === 2, "Make the variable <code>quotient</code> equal to 2.");' <ide> - text: Use the <code>/</code> operator <del> testString: 'assert(/\d+\s*\/\s*\d+/.test(code), ''Use the <code>/</code> operator'');' <add> testString: 'assert(/\d+\s*\/\s*\d+/.test(code), "Use the <code>/</code> operator");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.english.md <ide> Here is the text with the escape sequences written out. <ide> ```yml <ide> tests: <ide> - text: <code>myStr</code> should not contain any spaces <del> testString: 'assert(!/ /.test(myStr), ''<code>myStr</code> should not contain any spaces'');' <add> testString: 'assert(!/ /.test(myStr), "<code>myStr</code> should not contain any spaces");' <ide> - text: '<code>myStr</code> should contain the strings <code>FirstLine</code>, <code>SecondLine</code> and <code>ThirdLine</code> (remember case sensitivity)' <del> testString: 'assert(/FirstLine/.test(myStr) && /SecondLine/.test(myStr) && /ThirdLine/.test(myStr), ''<code>myStr</code> should contain the strings <code>FirstLine</code>, <code>SecondLine</code> and <code>ThirdLine</code> (remember case sensitivity)'');' <add> testString: 'assert(/FirstLine/.test(myStr) && /SecondLine/.test(myStr) && /ThirdLine/.test(myStr), "<code>myStr</code> should contain the strings <code>FirstLine</code>, <code>SecondLine</code> and <code>ThirdLine</code> (remember case sensitivity)");' <ide> - text: <code>FirstLine</code> should be followed by the newline character <code>\n</code> <del> testString: 'assert(/FirstLine\n/.test(myStr), ''<code>FirstLine</code> should be followed by the newline character <code>\n</code>'');' <add> testString: 'assert(/FirstLine\n/.test(myStr), "<code>FirstLine</code> should be followed by the newline character <code>\n</code>");' <ide> - text: <code>myStr</code> should contain a tab character <code>\t</code> which follows a newline character <del> testString: 'assert(/\n\t/.test(myStr), ''<code>myStr</code> should contain a tab character <code>\t</code> which follows a newline character'');' <add> testString: 'assert(/\n\t/.test(myStr), "<code>myStr</code> should contain a tab character <code>\t</code> which follows a newline character");' <ide> - text: <code>SecondLine</code> should be preceded by the backslash character <code>\\</code> <del> testString: 'assert(/\SecondLine/.test(myStr), ''<code>SecondLine</code> should be preceded by the backslash character <code>\\</code>'');' <add> testString: 'assert(/\SecondLine/.test(myStr), "<code>SecondLine</code> should be preceded by the backslash character <code>\\</code>");' <ide> - text: There should be a newline character between <code>SecondLine</code> and <code>ThirdLine</code> <del> testString: 'assert(/SecondLine\nThirdLine/.test(myStr), ''There should be a newline character between <code>SecondLine</code> and <code>ThirdLine</code>'');' <add> testString: 'assert(/SecondLine\nThirdLine/.test(myStr), "There should be a newline character between <code>SecondLine</code> and <code>ThirdLine</code>");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.english.md <ide> Use <dfn>backslashes</dfn> to assign a string to the <code>myStr</code> variable <ide> ```yml <ide> tests: <ide> - text: 'You should use two double quotes (<code>&quot;</code>) and four escaped double quotes (<code>&#92;&quot;</code>).' <del> testString: 'assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2, ''You should use two double quotes (<code>&quot;</code>) and four escaped double quotes (<code>&#92;&quot;</code>).'');' <add> testString: 'assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2, "You should use two double quotes (<code>&quot;</code>) and four escaped double quotes (<code>&#92;&quot;</code>).");' <ide> - text: 'Variable myStr should contain the string: <code>I am a "double quoted" string inside "double quotes".</code>' <del> testString: 'assert(myStr === "I am a \"double quoted\" string inside \"double quotes\".", ''Variable myStr should contain the string: <code>I am a "double quoted" string inside "double quotes".</code>'');' <add> testString: 'assert(myStr === "I am a \"double quoted\" string inside \"double quotes\".", "Variable myStr should contain the string: <code>I am a "double quoted" string inside "double quotes".</code>");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.english.md <ide> Use the <code>.length</code> property to count the number of characters in the < <ide> ```yml <ide> tests: <ide> - text: <code>lastNameLength</code> should be equal to eight. <del> testString: 'assert((function(){if(typeof lastNameLength !== "undefined" && typeof lastNameLength === "number" && lastNameLength === 8){return true;}else{return false;}})(), ''<code>lastNameLength</code> should be equal to eight.'');' <add> testString: 'assert((function(){if(typeof lastNameLength !== "undefined" && typeof lastNameLength === "number" && lastNameLength === 8){return true;}else{return false;}})(), "<code>lastNameLength</code> should be equal to eight.");' <ide> - text: 'You should be getting the length of <code>lastName</code> by using <code>.length</code> like this: <code>lastName.length</code>.' <del> testString: 'assert((function(){if(code.match(/\.length/gi) && code.match(/\.length/gi).length >= 2 && code.match(/var lastNameLength \= 0;/gi) && code.match(/var lastNameLength \= 0;/gi).length >= 1){return true;}else{return false;}})(), ''You should be getting the length of <code>lastName</code> by using <code>.length</code> like this: <code>lastName.length</code>.'');' <add> testString: 'assert((function(){if(code.match(/\.length/gi) && code.match(/\.length/gi).length >= 2 && code.match(/var lastNameLength \= 0;/gi) && code.match(/var lastNameLength \= 0;/gi).length >= 1){return true;}else{return false;}})(), "You should be getting the length of <code>lastName</code> by using <code>.length</code> like this: <code>lastName.length</code>.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.english.md <ide> Set <code>remainder</code> equal to the remainder of <code>11</code> divided by <ide> ```yml <ide> tests: <ide> - text: The variable <code>remainder</code> should be initialized <del> testString: 'assert(/var\s+?remainder/.test(code), ''The variable <code>remainder</code> should be initialized'');' <add> testString: 'assert(/var\s+?remainder/.test(code), "The variable <code>remainder</code> should be initialized");' <ide> - text: The value of <code>remainder</code> should be <code>2</code> <del> testString: 'assert(remainder === 2, ''The value of <code>remainder</code> should be <code>2</code>'');' <add> testString: 'assert(remainder === 2, "The value of <code>remainder</code> should be <code>2</code>");' <ide> - text: You should use the <code>%</code> operator <del> testString: 'assert(/\s+?remainder\s*?=\s*?.*%.*;/.test(code), ''You should use the <code>%</code> operator'');' <add> testString: 'assert(/\s+?remainder\s*?=\s*?.*%.*;/.test(code), "You should use the <code>%</code> operator");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.english.md <ide> Change <code>randomFraction</code> to return a random number instead of returnin <ide> ```yml <ide> tests: <ide> - text: <code>randomFraction</code> should return a random number. <del> testString: 'assert(typeof randomFraction() === "number", ''<code>randomFraction</code> should return a random number.'');' <add> testString: 'assert(typeof randomFraction() === "number", "<code>randomFraction</code> should return a random number.");' <ide> - text: The number returned by <code>randomFraction</code> should be a decimal. <del> testString: 'assert((randomFraction()+''''). match(/\./g), ''The number returned by <code>randomFraction</code> should be a decimal.'');' <add> testString: 'assert((randomFraction()+""). match(/\./g), "The number returned by <code>randomFraction</code> should be a decimal.");' <ide> - text: You should be using <code>Math.random</code> to generate the random decimal number. <del> testString: 'assert(code.match(/Math\.random/g).length >= 0, ''You should be using <code>Math.random</code> to generate the random decimal number.'');' <add> testString: 'assert(code.match(/Math\.random/g).length >= 0, "You should be using <code>Math.random</code> to generate the random decimal number.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.english.md <ide> Use this technique to generate and return a random whole number between <code>0< <ide> ```yml <ide> tests: <ide> - text: The result of <code>randomWholeNum</code> should be a whole number. <del> testString: 'assert(typeof randomWholeNum() === "number" && (function(){var r = randomWholeNum();return Math.floor(r) === r;})(), ''The result of <code>randomWholeNum</code> should be a whole number.'');' <add> testString: 'assert(typeof randomWholeNum() === "number" && (function(){var r = randomWholeNum();return Math.floor(r) === r;})(), "The result of <code>randomWholeNum</code> should be a whole number.");' <ide> - text: You should be using <code>Math.random</code> to generate a random number. <del> testString: 'assert(code.match(/Math.random/g).length > 1, ''You should be using <code>Math.random</code> to generate a random number.'');' <add> testString: 'assert(code.match(/Math.random/g).length > 1, "You should be using <code>Math.random</code> to generate a random number.");' <ide> - text: You should have multiplied the result of <code>Math.random</code> by 10 to make it a number that is between zero and nine. <del> testString: 'assert(code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g), ''You should have multiplied the result of <code>Math.random</code> by 10 to make it a number that is between zero and nine.'');' <add> testString: 'assert(code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g), "You should have multiplied the result of <code>Math.random</code> by 10 to make it a number that is between zero and nine.");' <ide> - text: You should use <code>Math.floor</code> to remove the decimal part of the number. <del> testString: 'assert(code.match(/Math.floor/g).length > 1, ''You should use <code>Math.floor</code> to remove the decimal part of the number.'');' <add> testString: 'assert(code.match(/Math.floor/g).length > 1, "You should use <code>Math.floor</code> to remove the decimal part of the number.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.english.md <ide> Create a function called <code>randomRange</code> that takes a range <code>myMin <ide> ```yml <ide> tests: <ide> - text: 'The lowest random number that can be generated by <code>randomRange</code> should be equal to your minimum number, <code>myMin</code>.' <del> testString: 'assert(calcMin === 5, ''The lowest random number that can be generated by <code>randomRange</code> should be equal to your minimum number, <code>myMin</code>.'');' <add> testString: 'assert(calcMin === 5, "The lowest random number that can be generated by <code>randomRange</code> should be equal to your minimum number, <code>myMin</code>.");' <ide> - text: 'The highest random number that can be generated by <code>randomRange</code> should be equal to your maximum number, <code>myMax</code>.' <del> testString: 'assert(calcMax === 15, ''The highest random number that can be generated by <code>randomRange</code> should be equal to your maximum number, <code>myMax</code>.'');' <add> testString: 'assert(calcMax === 15, "The highest random number that can be generated by <code>randomRange</code> should be equal to your maximum number, <code>myMax</code>.");' <ide> - text: 'The random number generated by <code>randomRange</code> should be an integer, not a decimal.' <del> testString: 'assert(randomRange(0,1) % 1 === 0 , ''The random number generated by <code>randomRange</code> should be an integer, not a decimal.'');' <add> testString: 'assert(randomRange(0,1) % 1 === 0 , "The random number generated by <code>randomRange</code> should be an integer, not a decimal.");' <ide> - text: '<code>randomRange</code> should use both <code>myMax</code> and <code>myMin</code>, and return a random number in your range.' <del> testString: 'assert((function(){if(code.match(/myMax/g).length > 1 && code.match(/myMin/g).length > 2 && code.match(/Math.floor/g) && code.match(/Math.random/g)){return true;}else{return false;}})(), ''<code>randomRange</code> should use both <code>myMax</code> and <code>myMin</code>, and return a random number in your range.'');' <add> testString: 'assert((function(){if(code.match(/myMax/g).length > 1 && code.match(/myMin/g).length > 2 && code.match(/Math.floor/g) && code.match(/Math.random/g)){return true;}else{return false;}})(), "<code>randomRange</code> should use both <code>myMax</code> and <code>myMin</code>, and return a random number in your range.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.english.md <ide> Inside function <code>fun1</code>, assign <code>5</code> to <code>oopsGlobal</co <ide> ```yml <ide> tests: <ide> - text: <code>myGlobal</code> should be defined <del> testString: 'assert(typeof myGlobal != "undefined", ''<code>myGlobal</code> should be defined'');' <add> testString: 'assert(typeof myGlobal != "undefined", "<code>myGlobal</code> should be defined");' <ide> - text: <code>myGlobal</code> should have a value of <code>10</code> <del> testString: 'assert(myGlobal === 10, ''<code>myGlobal</code> should have a value of <code>10</code>'');' <add> testString: 'assert(myGlobal === 10, "<code>myGlobal</code> should have a value of <code>10</code>");' <ide> - text: <code>myGlobal</code> should be declared using the <code>var</code> keyword <del> testString: 'assert(/var\s+myGlobal/.test(code), ''<code>myGlobal</code> should be declared using the <code>var</code> keyword'');' <add> testString: 'assert(/var\s+myGlobal/.test(code), "<code>myGlobal</code> should be declared using the <code>var</code> keyword");' <ide> - text: <code>oopsGlobal</code> should be a global variable and have a value of <code>5</code> <del> testString: 'assert(typeof oopsGlobal != "undefined" && oopsGlobal === 5, ''<code>oopsGlobal</code> should be a global variable and have a value of <code>5</code>'');' <add> testString: 'assert(typeof oopsGlobal != "undefined" && oopsGlobal === 5, "<code>oopsGlobal</code> should be a global variable and have a value of <code>5</code>");' <ide> <ide> ``` <ide> <ide> tests: <ide> <ide> function fun1() { <ide> // Assign 5 to oopsGlobal Here <del> <add> <ide> } <ide> <ide> // Only change code above this line <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.english.md <ide> Add a local variable to <code>myOutfit</code> function to override the value of <ide> ```yml <ide> tests: <ide> - text: Do not change the value of the global <code>outerWear</code> <del> testString: 'assert(outerWear === "T-Shirt", ''Do not change the value of the global <code>outerWear</code>'');' <add> testString: 'assert(outerWear === "T-Shirt", "Do not change the value of the global <code>outerWear</code>");' <ide> - text: <code>myOutfit</code> should return <code>"sweater"</code> <del> testString: 'assert(myOutfit() === "sweater", ''<code>myOutfit</code> should return <code>"sweater"</code>'');' <add> testString: 'assert(myOutfit() === "sweater", "<code>myOutfit</code> should return <code>"sweater"</code>");' <ide> - text: Do not change the return statement <del> testString: 'assert(/return outerWear/.test(code), ''Do not change the return statement'');' <add> testString: 'assert(/return outerWear/.test(code), "Do not change the return statement");' <ide> <ide> ``` <ide> <ide> var outerWear = "T-Shirt"; <ide> <ide> function myOutfit() { <ide> // Only change code below this line <del> <del> <del> <add> <add> <add> <ide> // Only change code above this line <ide> return outerWear; <ide> } <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.english.md <ide> Your function will be passed <code>par</code> and <code>strokes</code> arguments <ide> ```yml <ide> tests: <ide> - text: '<code>golfScore(4, 1)</code> should return "Hole-in-one!"' <del> testString: 'assert(golfScore(4, 1) === "Hole-in-one!", ''<code>golfScore(4, 1)</code> should return "Hole-in-one!"'');' <add> testString: 'assert(golfScore(4, 1) === "Hole-in-one!", "<code>golfScore(4, 1)</code> should return "Hole-in-one!"");' <ide> - text: '<code>golfScore(4, 2)</code> should return "Eagle"' <del> testString: 'assert(golfScore(4, 2) === "Eagle", ''<code>golfScore(4, 2)</code> should return "Eagle"'');' <add> testString: 'assert(golfScore(4, 2) === "Eagle", "<code>golfScore(4, 2)</code> should return "Eagle"");' <ide> - text: '<code>golfScore(5, 2)</code> should return "Eagle"' <del> testString: 'assert(golfScore(5, 2) === "Eagle", ''<code>golfScore(5, 2)</code> should return "Eagle"'');' <add> testString: 'assert(golfScore(5, 2) === "Eagle", "<code>golfScore(5, 2)</code> should return "Eagle"");' <ide> - text: '<code>golfScore(4, 3)</code> should return "Birdie"' <del> testString: 'assert(golfScore(4, 3) === "Birdie", ''<code>golfScore(4, 3)</code> should return "Birdie"'');' <add> testString: 'assert(golfScore(4, 3) === "Birdie", "<code>golfScore(4, 3)</code> should return "Birdie"");' <ide> - text: '<code>golfScore(4, 4)</code> should return "Par"' <del> testString: 'assert(golfScore(4, 4) === "Par", ''<code>golfScore(4, 4)</code> should return "Par"'');' <add> testString: 'assert(golfScore(4, 4) === "Par", "<code>golfScore(4, 4)</code> should return "Par"");' <ide> - text: '<code>golfScore(1, 1)</code> should return "Hole-in-one!"' <del> testString: 'assert(golfScore(1, 1) === "Hole-in-one!", ''<code>golfScore(1, 1)</code> should return "Hole-in-one!"'');' <add> testString: 'assert(golfScore(1, 1) === "Hole-in-one!", "<code>golfScore(1, 1)</code> should return "Hole-in-one!"");' <ide> - text: '<code>golfScore(5, 5)</code> should return "Par"' <del> testString: 'assert(golfScore(5, 5) === "Par", ''<code>golfScore(5, 5)</code> should return "Par"'');' <add> testString: 'assert(golfScore(5, 5) === "Par", "<code>golfScore(5, 5)</code> should return "Par"");' <ide> - text: '<code>golfScore(4, 5)</code> should return "Bogey"' <del> testString: 'assert(golfScore(4, 5) === "Bogey", ''<code>golfScore(4, 5)</code> should return "Bogey"'');' <add> testString: 'assert(golfScore(4, 5) === "Bogey", "<code>golfScore(4, 5)</code> should return "Bogey"");' <ide> - text: '<code>golfScore(4, 6)</code> should return "Double Bogey"' <del> testString: 'assert(golfScore(4, 6) === "Double Bogey", ''<code>golfScore(4, 6)</code> should return "Double Bogey"'');' <add> testString: 'assert(golfScore(4, 6) === "Double Bogey", "<code>golfScore(4, 6)</code> should return "Double Bogey"");' <ide> - text: '<code>golfScore(4, 7)</code> should return "Go Home!"' <del> testString: 'assert(golfScore(4, 7) === "Go Home!", ''<code>golfScore(4, 7)</code> should return "Go Home!"'');' <add> testString: 'assert(golfScore(4, 7) === "Go Home!", "<code>golfScore(4, 7)</code> should return "Go Home!"");' <ide> - text: '<code>golfScore(5, 9)</code> should return "Go Home!"' <del> testString: 'assert(golfScore(5, 9) === "Go Home!", ''<code>golfScore(5, 9)</code> should return "Go Home!"'');' <add> testString: 'assert(golfScore(5, 9) === "Go Home!", "<code>golfScore(5, 9)</code> should return "Go Home!"");' <ide> <ide> ``` <ide> <ide> tests: <ide> var names = ["Hole-in-one!", "Eagle", "Birdie", "Par", "Bogey", "Double Bogey", "Go Home!"]; <ide> function golfScore(par, strokes) { <ide> // Only change code below this line <del> <del> <add> <add> <ide> return "Change Me"; <ide> // Only change code above this line <ide> } <ide> function golfScore(par, strokes) { <ide> if (strokes === 1) { <ide> return "Hole-in-one!"; <ide> } <del> <add> <ide> if (strokes <= par - 2) { <ide> return "Eagle"; <ide> } <del> <add> <ide> if (strokes === par - 1) { <ide> return "Birdie"; <ide> } <del> <add> <ide> if (strokes === par) { <ide> return "Par"; <ide> } <del> <add> <ide> if (strokes === par + 1) { <ide> return "Bogey"; <ide> } <del> <add> <ide> if(strokes === par + 2) { <ide> return "Double Bogey"; <ide> } <del> <add> <ide> return "Go Home!"; <ide> } <ide> ``` <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.english.md <ide> Change the code to use the <code>++</code> operator on <code>myVar</code>. <ide> ```yml <ide> tests: <ide> - text: <code>myVar</code> should equal <code>88</code> <del> testString: 'assert(myVar === 88, ''<code>myVar</code> should equal <code>88</code>'');' <add> testString: 'assert(myVar === 88, "<code>myVar</code> should equal <code>88</code>");' <ide> - text: <code>myVar = myVar + 1;</code> should be changed <del> testString: 'assert(/var\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2});/.test(code), ''<code>myVar = myVar + 1;</code> should be changed'');' <add> testString: 'assert(/var\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2});/.test(code), "<code>myVar = myVar + 1;</code> should be changed");' <ide> - text: Use the <code>++</code> operator <del> testString: 'assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code), ''Use the <code>++</code> operator'');' <add> testString: 'assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code), "Use the <code>++</code> operator");' <ide> - text: Do not change code above the line <del> testString: 'assert(/var myVar = 87;/.test(code), ''Do not change code above the line'');' <add> testString: 'assert(/var myVar = 87;/.test(code), "Do not change code above the line");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.english.md <ide> Define a variable <code>a</code> with <code>var</code> and initialize it to a va <ide> ```yml <ide> tests: <ide> - text: Initialize <code>a</code> to a value of <code>9</code> <del> testString: 'assert(/var\s+a\s*=\s*9\s*/.test(code), ''Initialize <code>a</code> to a value of <code>9</code>'');' <add> testString: 'assert(/var\s+a\s*=\s*9\s*/.test(code), "Initialize <code>a</code> to a value of <code>9</code>");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.english.md <ide> Convert the logic to use <code>else if</code> statements. <ide> ```yml <ide> tests: <ide> - text: You should have at least two <code>else</code> statements <del> testString: 'assert(code.match(/else/g).length > 1, ''You should have at least two <code>else</code> statements'');' <add> testString: 'assert(code.match(/else/g).length > 1, "You should have at least two <code>else</code> statements");' <ide> - text: You should have at least two <code>if</code> statements <del> testString: 'assert(code.match(/if/g).length > 1, ''You should have at least two <code>if</code> statements'');' <add> testString: 'assert(code.match(/if/g).length > 1, "You should have at least two <code>if</code> statements");' <ide> - text: You should have closing and opening curly braces for each condition <del> testString: 'assert(code.match(/if\s*\((.+)\)\s*\{[\s\S]+\}\s*else if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s*\{[\s\S]+\s*\}/), ''You should have closing and opening curly braces for each condition in your if else statement'');' <add> testString: 'assert(code.match(/if\s*\((.+)\)\s*\{[\s\S]+\}\s*else if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s*\{[\s\S]+\s*\}/), "You should have closing and opening curly braces for each condition in your if else statement");' <ide> - text: <code>testElseIf(0)</code> should return "Smaller than 5" <del> testString: 'assert(testElseIf(0) === "Smaller than 5", ''<code>testElseIf(0)</code> should return "Smaller than 5"'');' <add> testString: 'assert(testElseIf(0) === "Smaller than 5", "<code>testElseIf(0)</code> should return "Smaller than 5"");' <ide> - text: <code>testElseIf(5)</code> should return "Between 5 and 10" <del> testString: 'assert(testElseIf(5) === "Between 5 and 10", ''<code>testElseIf(5)</code> should return "Between 5 and 10"'');' <add> testString: 'assert(testElseIf(5) === "Between 5 and 10", "<code>testElseIf(5)</code> should return "Between 5 and 10"");' <ide> - text: <code>testElseIf(7)</code> should return "Between 5 and 10" <del> testString: 'assert(testElseIf(7) === "Between 5 and 10", ''<code>testElseIf(7)</code> should return "Between 5 and 10"'');' <add> testString: 'assert(testElseIf(7) === "Between 5 and 10", "<code>testElseIf(7)</code> should return "Between 5 and 10"");' <ide> - text: <code>testElseIf(10)</code> should return "Between 5 and 10" <del> testString: 'assert(testElseIf(10) === "Between 5 and 10", ''<code>testElseIf(10)</code> should return "Between 5 and 10"'');' <add> testString: 'assert(testElseIf(10) === "Between 5 and 10", "<code>testElseIf(10)</code> should return "Between 5 and 10"");' <ide> - text: <code>testElseIf(12)</code> should return "Greater than 10" <del> testString: 'assert(testElseIf(12) === "Greater than 10", ''<code>testElseIf(12)</code> should return "Greater than 10"'');' <add> testString: 'assert(testElseIf(12) === "Greater than 10", "<code>testElseIf(12)</code> should return "Greater than 10"");' <ide> <ide> ``` <ide> <ide> function testElseIf(val) { <ide> if (val > 10) { <ide> return "Greater than 10"; <ide> } <del> <add> <ide> if (val < 5) { <ide> return "Smaller than 5"; <ide> } <del> <add> <ide> return "Between 5 and 10"; <ide> } <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.english.md <ide> Combine the <code>if</code> statements into a single <code>if/else</code> statem <ide> ```yml <ide> tests: <ide> - text: You should only have one <code>if</code> statement in the editor <del> testString: 'assert(code.match(/if/g).length === 1, ''You should only have one <code>if</code> statement in the editor'');' <add> testString: 'assert(code.match(/if/g).length === 1, "You should only have one <code>if</code> statement in the editor");' <ide> - text: You should use an <code>else</code> statement <del> testString: 'assert(/else/g.test(code), ''You should use an <code>else</code> statement'');' <add> testString: 'assert(/else/g.test(code), "You should use an <code>else</code> statement");' <ide> - text: <code>testElse(4)</code> should return "5 or Smaller" <del> testString: 'assert(testElse(4) === "5 or Smaller", ''<code>testElse(4)</code> should return "5 or Smaller"'');' <add> testString: 'assert(testElse(4) === "5 or Smaller", "<code>testElse(4)</code> should return "5 or Smaller"");' <ide> - text: <code>testElse(5)</code> should return "5 or Smaller" <del> testString: 'assert(testElse(5) === "5 or Smaller", ''<code>testElse(5)</code> should return "5 or Smaller"'');' <add> testString: 'assert(testElse(5) === "5 or Smaller", "<code>testElse(5)</code> should return "5 or Smaller"");' <ide> - text: <code>testElse(6)</code> should return "Bigger than 5" <del> testString: 'assert(testElse(6) === "Bigger than 5", ''<code>testElse(6)</code> should return "Bigger than 5"'');' <add> testString: 'assert(testElse(6) === "Bigger than 5", "<code>testElse(6)</code> should return "Bigger than 5"");' <ide> - text: <code>testElse(10)</code> should return "Bigger than 5" <del> testString: 'assert(testElse(10) === "Bigger than 5", ''<code>testElse(10)</code> should return "Bigger than 5"'');' <add> testString: 'assert(testElse(10) === "Bigger than 5", "<code>testElse(10)</code> should return "Bigger than 5"");' <ide> - text: Do not change the code above or below the lines. <del> testString: 'assert(/var result = "";/.test(code) && /return result;/.test(code), ''Do not change the code above or below the lines.'');' <add> testString: 'assert(/var result = "";/.test(code) && /return result;/.test(code), "Do not change the code above or below the lines.");' <ide> <ide> ``` <ide> <ide> tests: <ide> function testElse(val) { <ide> var result = ""; <ide> // Only change code below this line <del> <add> <ide> if (val > 5) { <ide> result = "Bigger than 5"; <ide> } <del> <add> <ide> if (val <= 5) { <ide> result = "5 or Smaller"; <ide> } <del> <add> <ide> // Only change code above this line <ide> return result; <ide> } <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.english.md <ide> Push the odd numbers from 1 through 9 to <code>myArray</code> using a <code>for< <ide> ```yml <ide> tests: <ide> - text: You should be using a <code>for</code> loop for this. <del> testString: 'assert(code.match(/for\s*\(/g).length > 1, ''You should be using a <code>for</code> loop for this.'');' <add> testString: 'assert(code.match(/for\s*\(/g).length > 1, "You should be using a <code>for</code> loop for this.");' <ide> - text: '<code>myArray</code> should equal <code>[1,3,5,7,9]</code>.' <del> testString: 'assert.deepEqual(myArray, [1,3,5,7,9], ''<code>myArray</code> should equal <code>[1,3,5,7,9]</code>.'');' <add> testString: 'assert.deepEqual(myArray, [1,3,5,7,9], "<code>myArray</code> should equal <code>[1,3,5,7,9]</code>.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.english.md <ide> Declare and initialize a variable <code>total</code> to <code>0</code>. Use a <c <ide> ```yml <ide> tests: <ide> - text: <code>total</code> should be declared and initialized to 0 <del> testString: 'assert(code.match(/var.*?total\s*=\s*0.*?;/), ''<code>total</code> should be declared and initialized to 0'');' <add> testString: 'assert(code.match(/var.*?total\s*=\s*0.*?;/), "<code>total</code> should be declared and initialized to 0");' <ide> - text: <code>total</code> should equal 20 <del> testString: 'assert(total === 20, ''<code>total</code> should equal 20'');' <add> testString: 'assert(total === 20, "<code>total</code> should equal 20");' <ide> - text: You should use a <code>for</code> loop to iterate through <code>myArr</code> <del> testString: 'assert(code.match(/for\s*\(/g).length > 1 && code.match(/myArr\s*\[/), ''You should use a <code>for</code> loop to iterate through <code>myArr</code>'');' <add> testString: 'assert(code.match(/for\s*\(/g).length > 1 && code.match(/myArr\s*\[/), "You should use a <code>for</code> loop to iterate through <code>myArr</code>");' <ide> - text: Do not set <code>total</code> to 20 directly <del> testString: 'assert(!code.match(/total[\s\+\-]*=\s*(\d(?!\s*[;,])|[1-9])/g), ''Do not set <code>total</code> to 20 directly'');' <add> testString: 'assert(!code.match(/total[\s\+\-]*=\s*(\d(?!\s*[;,])|[1-9])/g), "Do not set <code>total</code> to 20 directly");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.english.md <ide> Change the <code>while</code> loop in the code to a <code>do...while</code> loop <ide> ```yml <ide> tests: <ide> - text: You should be using a <code>do...while</code> loop for this. <del> testString: 'assert(code.match(/do/g), ''You should be using a <code>do...while</code> loop for this.'');' <add> testString: 'assert(code.match(/do/g), "You should be using a <code>do...while</code> loop for this.");' <ide> - text: '<code>myArray</code> should equal <code>[10]</code>.' <del> testString: 'assert.deepEqual(myArray, [10], ''<code>myArray</code> should equal <code>[10]</code>.'');' <add> testString: 'assert.deepEqual(myArray, [10], "<code>myArray</code> should equal <code>[10]</code>.");' <ide> - text: <code>i</code> should equal <code>11</code> <del> testString: 'assert.deepEqual(i, 11, ''<code>i</code> should equal <code>11</code>'');' <add> testString: 'assert.deepEqual(i, 11, "<code>i</code> should equal <code>11</code>");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.english.md <ide> Use a <code>for</code> loop to work to push the values 1 through 5 onto <code>my <ide> ```yml <ide> tests: <ide> - text: You should be using a <code>for</code> loop for this. <del> testString: 'assert(code.match(/for\s*\(/g).length > 1, ''You should be using a <code>for</code> loop for this.'');' <add> testString: 'assert(code.match(/for\s*\(/g).length > 1, "You should be using a <code>for</code> loop for this.");' <ide> - text: '<code>myArray</code> should equal <code>[1,2,3,4,5]</code>.' <del> testString: 'assert.deepEqual(myArray, [1,2,3,4,5], ''<code>myArray</code> should equal <code>[1,2,3,4,5]</code>.'');' <add> testString: 'assert.deepEqual(myArray, [1,2,3,4,5], "<code>myArray</code> should equal <code>[1,2,3,4,5]</code>.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.english.md <ide> Push the numbers 0 through 4 to <code>myArray</code> using a <code>while</code> <ide> ```yml <ide> tests: <ide> - text: You should be using a <code>while</code> loop for this. <del> testString: 'assert(code.match(/while/g), ''You should be using a <code>while</code> loop for this.'');' <add> testString: 'assert(code.match(/while/g), "You should be using a <code>while</code> loop for this.");' <ide> - text: '<code>myArray</code> should equal <code>[0,1,2,3,4]</code>.' <del> testString: 'assert.deepEqual(myArray, [0,1,2,3,4], ''<code>myArray</code> should equal <code>[0,1,2,3,4]</code>.'');' <add> testString: 'assert.deepEqual(myArray, [0,1,2,3,4], "<code>myArray</code> should equal <code>[0,1,2,3,4]</code>.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.english.md <ide> Declare a local variable <code>myVar</code> inside <code>myLocalScope</code>. Ru <ide> ```yml <ide> tests: <ide> - text: No global <code>myVar</code> variable <del> testString: 'assert(typeof myVar === ''undefined'', ''No global <code>myVar</code> variable'');' <add> testString: 'assert(typeof myVar === "undefined", "No global <code>myVar</code> variable");' <ide> - text: Add a local <code>myVar</code> variable <del> testString: 'assert(/var\s+myVar/.test(code), ''Add a local <code>myVar</code> variable'');' <add> testString: 'assert(/var\s+myVar/.test(code), "Add a local <code>myVar</code> variable");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```js <ide> function myLocalScope() { <ide> 'use strict'; // you shouldn't need to edit this line <del> <add> <ide> console.log(myVar); <ide> } <ide> myLocalScope(); <ide> console.info('after the test'); <ide> ```js <ide> function myLocalScope() { <ide> 'use strict'; <del> <add> <ide> var myVar; <ide> console.log(myVar); <ide> } <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/logical-order-in-if-else-statements.english.md <ide> Change the order of logic in the function so that it will return the correct sta <ide> ```yml <ide> tests: <ide> - text: <code>orderMyLogic(4)</code> should return "Less than 5" <del> testString: 'assert(orderMyLogic(4) === "Less than 5", ''<code>orderMyLogic(4)</code> should return "Less than 5"'');' <add> testString: 'assert(orderMyLogic(4) === "Less than 5", "<code>orderMyLogic(4)</code> should return "Less than 5"");' <ide> - text: <code>orderMyLogic(6)</code> should return "Less than 10" <del> testString: 'assert(orderMyLogic(6) === "Less than 10", ''<code>orderMyLogic(6)</code> should return "Less than 10"'');' <add> testString: 'assert(orderMyLogic(6) === "Less than 10", "<code>orderMyLogic(6)</code> should return "Less than 10"");' <ide> - text: <code>orderMyLogic(11)</code> should return "Greater than or equal to 10" <del> testString: 'assert(orderMyLogic(11) === "Greater than or equal to 10", ''<code>orderMyLogic(11)</code> should return "Greater than or equal to 10"'');' <add> testString: 'assert(orderMyLogic(11) === "Greater than or equal to 10", "<code>orderMyLogic(11)</code> should return "Greater than or equal to 10"");' <ide> <ide> ``` <ide> <ide> orderMyLogic(7); <ide> ```js <ide> function orderMyLogic(val) { <ide> if(val < 5) { <del> return "Less than 5"; <add> return "Less than 5"; <ide> } else if (val < 10) { <ide> return "Less than 10"; <ide> } else { <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.english.md <ide> Use the <code>.pop()</code> function to remove the last item from <code>myArray< <ide> ```yml <ide> tests: <ide> - text: '<code>myArray</code> should only contain <code>[["John", 23]]</code>.' <del> testString: 'assert((function(d){if(d[0][0] == ''John'' && d[0][1] === 23 && d[1] == undefined){return true;}else{return false;}})(myArray), ''<code>myArray</code> should only contain <code>[["John", 23]]</code>.'');' <add> testString: 'assert((function(d){if(d[0][0] == "John" && d[0][1] === 23 && d[1] == undefined){return true;}else{return false;}})(myArray), "<code>myArray</code> should only contain <code>[["John", 23]]</code>.");' <ide> - text: Use <code>pop()</code> on <code>myArray</code> <del> testString: 'assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code), ''Use <code>pop()</code> on <code>myArray</code>'');' <add> testString: 'assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code), "Use <code>pop()</code> on <code>myArray</code>");' <ide> - text: '<code>removedFromMyArray</code> should only contain <code>["cat", 2]</code>.' <del> testString: 'assert((function(d){if(d[0] == ''cat'' && d[1] === 2 && d[2] == undefined){return true;}else{return false;}})(removedFromMyArray), ''<code>removedFromMyArray</code> should only contain <code>["cat", 2]</code>.'');' <add> testString: 'assert((function(d){if(d[0] == "cat" && d[1] === 2 && d[2] == undefined){return true;}else{return false;}})(removedFromMyArray), "<code>removedFromMyArray</code> should only contain <code>["cat", 2]</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```js <ide> // Example <ide> var ourArray = [1,2,3]; <del>var removedFromOurArray = ourArray.pop(); <add>var removedFromOurArray = ourArray.pop(); <ide> // removedFromOurArray now equals 3, and ourArray now equals [1,2] <ide> <ide> // Setup <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.english.md <ide> Push <code>["dog", 3]</code> onto the end of the <code>myArray</code> variable. <ide> ```yml <ide> tests: <ide> - text: '<code>myArray</code> should now equal <code>[["John", 23], ["cat", 2], ["dog", 3]]</code>.' <del> testString: 'assert((function(d){if(d[2] != undefined && d[0][0] == ''John'' && d[0][1] === 23 && d[2][0] == ''dog'' && d[2][1] === 3 && d[2].length == 2){return true;}else{return false;}})(myArray), ''<code>myArray</code> should now equal <code>[["John", 23], ["cat", 2], ["dog", 3]]</code>.'');' <add> testString: 'assert((function(d){if(d[2] != undefined && d[0][0] == "John" && d[0][1] === 23 && d[2][0] == "dog" && d[2][1] === 3 && d[2].length == 2){return true;}else{return false;}})(myArray), "<code>myArray</code> should now equal <code>[["John", 23], ["cat", 2], ["dog", 3]]</code>.");' <ide> <ide> ``` <ide> <ide> tests: <ide> ```js <ide> // Example <ide> var ourArray = ["Stimpson", "J", "cat"]; <del>ourArray.push(["happy", "joy"]); <add>ourArray.push(["happy", "joy"]); <ide> // ourArray now equals ["Stimpson", "J", "cat", ["happy", "joy"]] <ide> <ide> // Setup <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-shift.english.md <ide> Use the <code>.shift()</code> function to remove the first item from <code>myArr <ide> ```yml <ide> tests: <ide> - text: '<code>myArray</code> should now equal <code>[["dog", 3]]</code>.' <del> testString: 'assert((function(d){if(d[0][0] == ''dog'' && d[0][1] === 3 && d[1] == undefined){return true;}else{return false;}})(myArray), ''<code>myArray</code> should now equal <code>[["dog", 3]]</code>.'');' <add> testString: 'assert((function(d){if(d[0][0] == "dog" && d[0][1] === 3 && d[1] == undefined){return true;}else{return false;}})(myArray), "<code>myArray</code> should now equal <code>[["dog", 3]]</code>.");' <ide> - text: '<code>removedFromMyArray</code> should contain <code>["John", 23]</code>.' <del> testString: 'assert((function(d){if(d[0] == ''John'' && d[1] === 23 && typeof removedFromMyArray === ''object''){return true;}else{return false;}})(removedFromMyArray), ''<code>removedFromMyArray</code> should contain <code>["John", 23]</code>.'');' <add> testString: 'assert((function(d){if(d[0] == "John" && d[1] === 23 && typeof removedFromMyArray === "object"){return true;}else{return false;}})(removedFromMyArray), "<code>removedFromMyArray</code> should contain <code>["John", 23]</code>.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.english.md <ide> Add <code>["Paul",35]</code> to the beginning of the <code>myArray</code> variab <ide> ```yml <ide> tests: <ide> - text: '<code>myArray</code> should now have [["Paul", 35], ["dog", 3]].' <del> testString: 'assert((function(d){if(typeof d[0] === "object" && d[0][0] == ''Paul'' && d[0][1] === 35 && d[1][0] != undefined && d[1][0] == ''dog'' && d[1][1] != undefined && d[1][1] == 3){return true;}else{return false;}})(myArray), ''<code>myArray</code> should now have [["Paul", 35], ["dog", 3]].'');' <add> testString: 'assert((function(d){if(typeof d[0] === "object" && d[0][0] == "Paul" && d[0][1] === 35 && d[1][0] != undefined && d[1][0] == "dog" && d[1][1] != undefined && d[1][1] == 3){return true;}else{return false;}})(myArray), "<code>myArray</code> should now have [["Paul", 35], ["dog", 3]].");' <ide> <ide> ``` <ide> <ide> tests: <ide> // Example <ide> var ourArray = ["Stimpson", "J", "cat"]; <ide> ourArray.shift(); // ourArray now equals ["J", "cat"] <del>ourArray.unshift("Happy"); <add>ourArray.unshift("Happy"); <ide> // ourArray now equals ["Happy", "J", "cat"] <ide> <ide> // Setup <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.english.md <ide> Add a new album to the <code>myMusic</code> array. Add <code>artist</code> and < <ide> ```yml <ide> tests: <ide> - text: <code>myMusic</code> should be an array <del> testString: 'assert(Array.isArray(myMusic), ''<code>myMusic</code> should be an array'');' <add> testString: 'assert(Array.isArray(myMusic), "<code>myMusic</code> should be an array");' <ide> - text: <code>myMusic</code> should have at least two elements <del> testString: 'assert(myMusic.length > 1, ''<code>myMusic</code> should have at least two elements'');' <add> testString: 'assert(myMusic.length > 1, "<code>myMusic</code> should have at least two elements");' <ide> - text: '<code>myMusic[1]</code> should be an object' <del> testString: 'assert(typeof myMusic[1] === ''object'', ''<code>myMusic[1]</code> should be an object'');' <add> testString: 'assert(typeof myMusic[1] === "object", "<code>myMusic[1]</code> should be an object");' <ide> - text: '<code>myMusic[1]</code> should have at least 4 properties' <del> testString: 'assert(Object.keys(myMusic[1]).length > 3, ''<code>myMusic[1]</code> should have at least 4 properties'');' <add> testString: 'assert(Object.keys(myMusic[1]).length > 3, "<code>myMusic[1]</code> should have at least 4 properties");' <ide> - text: '<code>myMusic[1]</code> should contain an <code>artist</code> property which is a string' <del> testString: 'assert(myMusic[1].hasOwnProperty(''artist'') && typeof myMusic[1].artist === ''string'', ''<code>myMusic[1]</code> should contain an <code>artist</code> property which is a string'');' <add> testString: 'assert(myMusic[1].hasOwnProperty("artist") && typeof myMusic[1].artist === "string", "<code>myMusic[1]</code> should contain an <code>artist</code> property which is a string");' <ide> - text: '<code>myMusic[1]</code> should contain a <code>title</code> property which is a string' <del> testString: 'assert(myMusic[1].hasOwnProperty(''title'') && typeof myMusic[1].title === ''string'', ''<code>myMusic[1]</code> should contain a <code>title</code> property which is a string'');' <add> testString: 'assert(myMusic[1].hasOwnProperty("title") && typeof myMusic[1].title === "string", "<code>myMusic[1]</code> should contain a <code>title</code> property which is a string");' <ide> - text: '<code>myMusic[1]</code> should contain a <code>release_year</code> property which is a number' <del> testString: 'assert(myMusic[1].hasOwnProperty(''release_year'') && typeof myMusic[1].release_year === ''number'', ''<code>myMusic[1]</code> should contain a <code>release_year</code> property which is a number'');' <add> testString: 'assert(myMusic[1].hasOwnProperty("release_year") && typeof myMusic[1].release_year === "number", "<code>myMusic[1]</code> should contain a <code>release_year</code> property which is a number");' <ide> - text: '<code>myMusic[1]</code> should contain a <code>formats</code> property which is an array' <del> testString: 'assert(myMusic[1].hasOwnProperty(''formats'') && Array.isArray(myMusic[1].formats), ''<code>myMusic[1]</code> should contain a <code>formats</code> property which is an array'');' <add> testString: 'assert(myMusic[1].hasOwnProperty("formats") && Array.isArray(myMusic[1].formats), "<code>myMusic[1]</code> should contain a <code>formats</code> property which is an array");' <ide> - text: <code>formats</code> should be an array of strings with at least two elements <del> testString: 'assert(myMusic[1].formats.every(function(item) { return (typeof item === "string")}) && myMusic[1].formats.length > 1, ''<code>formats</code> should be an array of strings with at least two elements'');' <add> testString: 'assert(myMusic[1].formats.every(function(item) { return (typeof item === "string")}) && myMusic[1].formats.length > 1, "<code>formats</code> should be an array of strings with at least two elements");' <ide> <ide> ``` <ide> <ide> var myMusic = [ <ide> "artist": "Billy Joel", <ide> "title": "Piano Man", <ide> "release_year": 1973, <del> "formats": [ <add> "formats": [ <ide> "CD", <ide> "8T", <ide> "LP" <ide> var myMusic = [ <ide> "artist": "Billy Joel", <ide> "title": "Piano Man", <ide> "release_year": 1973, <del> "formats": [ <del> "CS", <del> "8T", <add> "formats": [ <add> "CS", <add> "8T", <ide> "LP" ], <ide> "gold": true <del> }, <add> }, <ide> { <ide> "artist": "ABBA", <ide> "title": "Ring Ring", <ide> "release_year": 1973, <del> "formats": [ <del> "CS", <del> "8T", <add> "formats": [ <add> "CS", <add> "8T", <ide> "LP", <ide> "CD", <ide> ] <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.english.md <ide> Modify the data stored at index <code>0</code> of <code>myArray</code> to a valu <ide> ```yml <ide> tests: <ide> - text: '<code>myArray</code> should now be [45,64,99].' <del> testString: 'assert((function(){if(typeof myArray != ''undefined'' && myArray[0] == 45 && myArray[1] == 64 && myArray[2] == 99){return true;}else{return false;}})(), ''<code>myArray</code> should now be [45,64,99].'');' <add> testString: 'assert((function(){if(typeof myArray != "undefined" && myArray[0] == 45 && myArray[1] == 64 && myArray[2] == 99){return true;}else{return false;}})(), "<code>myArray</code> should now be [45,64,99].");' <ide> - text: You should be using correct index to modify the value in <code>myArray</code>. <del> testString: 'assert((function(){if(code.match(/myArray\[0\]\s*=\s*/g)){return true;}else{return false;}})(), ''You should be using correct index to modify the value in <code>myArray</code>.'');' <add> testString: 'assert((function(){if(code.match(/myArray\[0\]\s*=\s*/g)){return true;}else{return false;}})(), "You should be using correct index to modify the value in <code>myArray</code>.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.english.md <ide> Write a switch statement to set <code>answer</code> for the following ranges:<br <ide> ```yml <ide> tests: <ide> - text: <code>sequentialSizes(1)</code> should return "Low" <del> testString: 'assert(sequentialSizes(1) === "Low", ''<code>sequentialSizes(1)</code> should return "Low"'');' <add> testString: 'assert(sequentialSizes(1) === "Low", "<code>sequentialSizes(1)</code> should return "Low"");' <ide> - text: <code>sequentialSizes(2)</code> should return "Low" <del> testString: 'assert(sequentialSizes(2) === "Low", ''<code>sequentialSizes(2)</code> should return "Low"'');' <add> testString: 'assert(sequentialSizes(2) === "Low", "<code>sequentialSizes(2)</code> should return "Low"");' <ide> - text: <code>sequentialSizes(3)</code> should return "Low" <del> testString: 'assert(sequentialSizes(3) === "Low", ''<code>sequentialSizes(3)</code> should return "Low"'');' <add> testString: 'assert(sequentialSizes(3) === "Low", "<code>sequentialSizes(3)</code> should return "Low"");' <ide> - text: <code>sequentialSizes(4)</code> should return "Mid" <del> testString: 'assert(sequentialSizes(4) === "Mid", ''<code>sequentialSizes(4)</code> should return "Mid"'');' <add> testString: 'assert(sequentialSizes(4) === "Mid", "<code>sequentialSizes(4)</code> should return "Mid"");' <ide> - text: <code>sequentialSizes(5)</code> should return "Mid" <del> testString: 'assert(sequentialSizes(5) === "Mid", ''<code>sequentialSizes(5)</code> should return "Mid"'');' <add> testString: 'assert(sequentialSizes(5) === "Mid", "<code>sequentialSizes(5)</code> should return "Mid"");' <ide> - text: <code>sequentialSizes(6)</code> should return "Mid" <del> testString: 'assert(sequentialSizes(6) === "Mid", ''<code>sequentialSizes(6)</code> should return "Mid"'');' <add> testString: 'assert(sequentialSizes(6) === "Mid", "<code>sequentialSizes(6)</code> should return "Mid"");' <ide> - text: <code>sequentialSizes(7)</code> should return "High" <del> testString: 'assert(sequentialSizes(7) === "High", ''<code>sequentialSizes(7)</code> should return "High"'');' <add> testString: 'assert(sequentialSizes(7) === "High", "<code>sequentialSizes(7)</code> should return "High"");' <ide> - text: <code>sequentialSizes(8)</code> should return "High" <del> testString: 'assert(sequentialSizes(8) === "High", ''<code>sequentialSizes(8)</code> should return "High"'');' <add> testString: 'assert(sequentialSizes(8) === "High", "<code>sequentialSizes(8)</code> should return "High"");' <ide> - text: <code>sequentialSizes(9)</code> should return "High" <del> testString: 'assert(sequentialSizes(9) === "High", ''<code>sequentialSizes(9)</code> should return "High"'');' <add> testString: 'assert(sequentialSizes(9) === "High", "<code>sequentialSizes(9)</code> should return "High"");' <ide> - text: You should not use any <code>if</code> or <code>else</code> statements <del> testString: 'assert(!/else/g.test(code) || !/if/g.test(code), ''You should not use any <code>if</code> or <code>else</code> statements'');' <add> testString: 'assert(!/else/g.test(code) || !/if/g.test(code), "You should not use any <code>if</code> or <code>else</code> statements");' <ide> - text: You should have nine <code>case</code> statements <del> testString: 'assert(code.match(/case/g).length === 9, ''You should have nine <code>case</code> statements'');' <add> testString: 'assert(code.match(/case/g).length === 9, "You should have nine <code>case</code> statements");' <ide> <ide> ``` <ide> <ide> tests: <ide> function sequentialSizes(val) { <ide> var answer = ""; <ide> // Only change code below this line <del> <del> <del> <del> // Only change code above this line <del> return answer; <add> <add> <add> <add> // Only change code above this line <add> return answer; <ide> } <ide> <ide> // Change this value to test <ide> sequentialSizes(1); <ide> ```js <ide> function sequentialSizes(val) { <ide> var answer = ""; <del> <add> <ide> switch(val) { <ide> case 1: <ide> case 2: <ide> function sequentialSizes(val) { <ide> case 9: <ide> answer = "High"; <ide> } <del> <del> return answer; <add> <add> return answer; <ide> } <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.english.md <ide> Change the <code>0.0</code> so that product will equal <code>5.0</code>. <ide> ```yml <ide> tests: <ide> - text: The variable <code>product</code> should equal <code>5.0</code>. <del> testString: 'assert(product === 5.0, ''The variable <code>product</code> should equal <code>5.0</code>.'');' <add> testString: 'assert(product === 5.0, "The variable <code>product</code> should equal <code>5.0</code>.");' <ide> - text: You should use the <code>*</code> operator <del> testString: 'assert(/\*/.test(code), ''You should use the <code>*</code> operator'');' <add> testString: 'assert(/\*/.test(code), "You should use the <code>*</code> operator");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.english.md <ide> Change the <code>0</code> so that product will equal <code>80</code>. <ide> ```yml <ide> tests: <ide> - text: Make the variable <code>product</code> equal 80 <del> testString: 'assert(product === 80,''Make the variable <code>product</code> equal 80'');' <add> testString: 'assert(product === 80,"Make the variable <code>product</code> equal 80");' <ide> - text: Use the <code>*</code> operator <del> testString: 'assert(/\*/.test(code), ''Use the <code>*</code> operator'');' <add> testString: 'assert(/\*/.test(code), "Use the <code>*</code> operator");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.english.md <ide> Create a nested array called <code>myArray</code>. <ide> ```yml <ide> tests: <ide> - text: <code>myArray</code> should have at least one array nested within another array. <del> testString: 'assert(Array.isArray(myArray) && myArray.some(Array.isArray), ''<code>myArray</code> should have at least one array nested within another array.'');' <add> testString: 'assert(Array.isArray(myArray) && myArray.some(Array.isArray), "<code>myArray</code> should have at least one array nested within another array.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops.english.md <ide> Modify function <code>multiplyAll</code> so that it multiplies the <code>product <ide> ```yml <ide> tests: <ide> - text: '<code>multiplyAll([[1],[2],[3]])</code> should return <code>6</code>' <del> testString: 'assert(multiplyAll([[1],[2],[3]]) === 6, ''<code>multiplyAll([[1],[2],[3]])</code> should return <code>6</code>'');' <add> testString: 'assert(multiplyAll([[1],[2],[3]]) === 6, "<code>multiplyAll([[1],[2],[3]])</code> should return <code>6</code>");' <ide> - text: '<code>multiplyAll([[1,2],[3,4],[5,6,7]])</code> should return <code>5040</code>' <del> testString: 'assert(multiplyAll([[1,2],[3,4],[5,6,7]]) === 5040, ''<code>multiplyAll([[1,2],[3,4],[5,6,7]])</code> should return <code>5040</code>'');' <add> testString: 'assert(multiplyAll([[1,2],[3,4],[5,6,7]]) === 5040, "<code>multiplyAll([[1,2],[3,4],[5,6,7]])</code> should return <code>5040</code>");' <ide> - text: '<code>multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]])</code> should return <code>54</code>' <del> testString: 'assert(multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]]) === 54, ''<code>multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]])</code> should return <code>54</code>'');' <add> testString: 'assert(multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]]) === 54, "<code>multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]])</code> should return <code>54</code>");' <ide> <ide> ``` <ide> <ide> tests: <ide> function multiplyAll(arr) { <ide> var product = 1; <ide> // Only change code below this line <del> <add> <ide> // Only change code above this line <ide> return product; <ide> } <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.english.md <ide> We have passed two arguments, <code>"Hello"</code> and <code>"World"</code>. Ins <ide> ```yml <ide> tests: <ide> - text: <code>functionWithArgs</code> should be a function <del> testString: 'assert(typeof functionWithArgs === ''function'', ''<code>functionWithArgs</code> should be a function'');' <add> testString: 'assert(typeof functionWithArgs === "function", "<code>functionWithArgs</code> should be a function");' <ide> - text: '<code>functionWithArgs(1,2)</code> should output <code>3</code>' <del> testString: 'if(typeof functionWithArgs === "function") { capture(); functionWithArgs(1,2); uncapture(); } assert(logOutput == 3, ''<code>functionWithArgs(1,2)</code> should output <code>3</code>'');' <add> testString: 'if(typeof functionWithArgs === "function") { capture(); functionWithArgs(1,2); uncapture(); } assert(logOutput == 3, "<code>functionWithArgs(1,2)</code> should output <code>3</code>");' <ide> - text: '<code>functionWithArgs(7,9)</code> should output <code>16</code>' <del> testString: 'if(typeof functionWithArgs === "function") { capture(); functionWithArgs(7,9); uncapture(); } assert(logOutput == 16, ''<code>functionWithArgs(7,9)</code> should output <code>16</code>'');' <add> testString: 'if(typeof functionWithArgs === "function") { capture(); functionWithArgs(7,9); uncapture(); } assert(logOutput == 16, "<code>functionWithArgs(7,9)</code> should output <code>16</code>");' <ide> - text: Call <code>functionWithArgs</code> with two numbers after you define it. <del> testString: 'assert(/^\s*functionWithArgs\s*\(\s*\d+\s*,\s*\d+\s*\)\s*;/m.test(code), ''Call <code>functionWithArgs</code> with two numbers after you define it.'');' <add> testString: 'assert(/^\s*functionWithArgs\s*\(\s*\d+\s*,\s*\d+\s*\)\s*;/m.test(code), "Call <code>functionWithArgs</code> with two numbers after you define it.");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.english.md <ide> The <code>compareEquality</code> function in the editor compares two values usin <ide> ```yml <ide> tests: <ide> - text: '<code>compareEquality(10, "10")</code> should return "Not Equal"' <del> testString: 'assert(compareEquality(10, "10") === "Not Equal", ''<code>compareEquality(10, "10")</code> should return "Not Equal"'');' <add> testString: 'assert(compareEquality(10, "10") === "Not Equal", "<code>compareEquality(10, "10")</code> should return "Not Equal"");' <ide> - text: '<code>compareEquality("20", 20)</code> should return "Not Equal"' <del> testString: 'assert(compareEquality("20", 20) === "Not Equal", ''<code>compareEquality("20", 20)</code> should return "Not Equal"'');' <add> testString: 'assert(compareEquality("20", 20) === "Not Equal", "<code>compareEquality("20", 20)</code> should return "Not Equal"");' <ide> - text: You should use the <code>===</code> operator <del> testString: 'assert(code.match(/===/g), ''You should use the <code>===</code> operator'');' <add> testString: 'assert(code.match(/===/g), "You should use the <code>===</code> operator");' <ide> <ide> ``` <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.english.md <ide> If <code>prop</code> does not correspond to any valid properties of a contact fo <ide> ```yml <ide> tests: <ide> - text: '<code>"Kristian", "lastName"</code> should return <code>"Vos"</code>' <del> testString: 'assert(lookUpProfile(''Kristian'',''lastName'') === "Vos", ''<code>"Kristian", "lastName"</code> should return <code>"Vos"</code>'');' <add> testString: 'assert(lookUpProfile("Kristian","lastName") === "Vos", "<code>"Kristian", "lastName"</code> should return <code>"Vos"</code>");' <ide> - text: '<code>"Sherlock", "likes"</code> should return <code>["Intriguing Cases", "Violin"]</code>' <del> testString: 'assert.deepEqual(lookUpProfile("Sherlock", "likes"), ["Intriguing Cases", "Violin"], ''<code>"Sherlock", "likes"</code> should return <code>["Intriguing Cases", "Violin"]</code>'');' <add> testString: 'assert.deepEqual(lookUpProfile("Sherlock", "likes"), ["Intriguing Cases", "Violin"], "<code>"Sherlock", "likes"</code> should return <code>["Intriguing Cases", "Violin"]</code>");' <ide> - text: '<code>"Harry","likes"</code> should return an array' <del> testString: 'assert(typeof lookUpProfile("Harry", "likes") === "object", ''<code>"Harry","likes"</code> should return an array'');' <add> testString: 'assert(typeof lookUpProfile("Harry", "likes") === "object", "<code>"Harry","likes"</code> should return an array");' <ide> - text: '<code>"Bob", "number"</code> should return "No such contact"' <del> testString: 'assert(lookUpProfile("Bob", "number") === "No such contact", ''<code>"Bob", "number"</code> should return "No such contact"'');' <add> testString: 'assert(lookUpProfile("Bob", "number") === "No such contact", "<code>"Bob", "number"</code> should return "No such contact"");' <ide> - text: '<code>"Bob", "potato"</code> should return "No such contact"' <del> testString: 'assert(lookUpProfile("Bob", "potato") === "No such contact", ''<code>"Bob", "potato"</code> should return "No such contact"'');' <add> testString: 'assert(lookUpProfile("Bob", "potato") === "No such contact", "<code>"Bob", "potato"</code> should return "No such contact"");' <ide> - text: '<code>"Akira", "address"</code> should return "No such property"' <del> testString: 'assert(lookUpProfile("Akira", "address") === "No such property", ''<code>"Akira", "address"</code> should return "No such property"'');' <add> testString: 'assert(lookUpProfile("Akira", "address") === "No such property", "<code>"Akira", "address"</code> should return "No such property"");' <ide> <ide> ``` <ide>
300
Text
Text
fix minor formatting issue
3d94da3f0e03c143a2adcc3091b6a64991517576
<ide><path>guides/source/threading_and_code_execution.md <ide> code to execute each job as it comes off the queue. <ide> <ide> Action Cable uses the Executor instead: because a Cable connection is linked to <ide> a specific instance of a class, it's not possible to reload for every arriving <del>websocket message. Only the message handler is wrapped, though; a long-running <add>WebSocket message. Only the message handler is wrapped, though; a long-running <ide> Cable connection does not prevent a reload that's triggered by a new incoming <ide> request or job. Instead, Action Cable uses the Reloader's `before_class_unload` <ide> callback to disconnect all its connections. When the client automatically
1
Ruby
Ruby
follow the documentation guideline
0af0ffde1896f1796712493984a6ebc30a532a7f
<ide><path>actionview/lib/action_view/view_paths.rb <ide> def _prefixes # :nodoc: <ide> private <ide> <ide> # Override this method in your controller if you want to change paths prefixes for finding views. <del> # Prefixes defined here will still be added to parents' <tt>::_prefixes</tt>. <add> # Prefixes defined here will still be added to parents' <tt>._prefixes</tt>. <ide> def local_prefixes <ide> [controller_path] <ide> end
1
Javascript
Javascript
fix bug in enterleave
6778c53c16a6cdbda04d22628a95f2e1627f3ef4
<ide><path>packages/react-dom/src/events/plugins/ModernEnterLeaveEventPlugin.js <ide> const EnterLeaveEventPlugin = { <ide> topLevelType === TOP_MOUSE_OVER || topLevelType === TOP_POINTER_OVER; <ide> const isOutEvent = <ide> topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_POINTER_OUT; <del> const related = nativeEvent.relatedTarget || nativeEvent.fromElement; <del> <del> if (isOverEvent && (eventSystemFlags & IS_REPLAYED) === 0 && related) { <del> // Due to the fact we don't add listeners to the document with the <del> // modern event system and instead attach listeners to roots, we <del> // need to handle the over event case. To ensure this, we just need to <del> // make sure the node that we're coming from is managed by React. <del> const inst = getClosestInstanceFromNode(related); <del> if (inst !== null) { <del> return; <add> <add> if (isOverEvent && (eventSystemFlags & IS_REPLAYED) === 0) { <add> const related = nativeEvent.relatedTarget || nativeEvent.fromElement; <add> if (related) { <add> // Due to the fact we don't add listeners to the document with the <add> // modern event system and instead attach listeners to roots, we <add> // need to handle the over event case. To ensure this, we just need to <add> // make sure the node that we're coming from is managed by React. <add> const inst = getClosestInstanceFromNode(related); <add> if (inst !== null) { <add> return; <add> } <ide> } <ide> } <ide> <ide> const EnterLeaveEventPlugin = { <ide> let from; <ide> let to; <ide> if (isOutEvent) { <add> const related = nativeEvent.relatedTarget || nativeEvent.toElement; <ide> from = targetInst; <ide> to = related ? getClosestInstanceFromNode(related) : null; <ide> if (to !== null) {
1
Ruby
Ruby
fix bad mutable call on a frozen string
2f21de596fa11e6a6113d367393d734ce08208a9
<ide><path>Library/Homebrew/build_environment.rb <ide> def dump_build_env(env, f = $stdout) <ide> s = "#{key}: #{value}" <ide> case key <ide> when "CC", "CXX", "LD" <del> s << " => #{Pathname.new(value).realpath}" if File.symlink?(value) <add> s += " => #{Pathname.new(value).realpath}" if File.symlink?(value) <ide> end <ide> f.puts s <ide> end
1
Text
Text
fix broken references
983a809456b4e993e4defb818ddee3ca0e03b84d
<ide><path>doc/api/child_process.md <ide> console.log('中文测试'); <ide> [`child_process.spawnSync()`]: #child_process_child_process_spawnsync_command_args_options <ide> [`ChildProcess`]: #child_process_child_process <ide> [`Error`]: errors.html#errors_class_error <del>[`EventEmitter`]: events.html#events_class_events_eventemitter <add>[`EventEmitter`]: events.html#events_class_eventemitter <ide> [`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify <ide> [`maxBuffer`]: #child_process_maxbuffer_and_unicode <ide> [`net.Server`]: net.html#net_class_net_server <ide> console.log('中文测试'); <ide> [`process.execPath`]: process.html#process_process_execpath <ide> [`process.on('disconnect')`]: process.html#process_event_disconnect <ide> [`process.on('message')`]: process.html#process_event_message <del>[`process.send()`]: process.html#process_process_send_message_sendhandle_callback <add>[`process.send()`]: process.html#process_process_send_message_sendhandle_options_callback <ide> [`stdio`]: #child_process_options_stdio <ide> [synchronous counterparts]: #child_process_synchronous_process_creation <ide><path>doc/api/process.md <ide> Will print something like: <ide> [`end()`]: stream.html#stream_writable_end_chunk_encoding_callback <ide> [`Error`]: errors.html#errors_class_error <ide> [`EventEmitter`]: events.html#events_class_eventemitter <del>[`EventEmitter`]: events.html#events_class_events_eventemitter <ide> [`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify <ide> [`net.Server`]: net.html#net_class_net_server <ide> [`net.Socket`]: net.html#net_class_net_socket <ide> Will print something like: <ide> [`require.main`]: modules.html#modules_accessing_the_main_module <ide> [`setTimeout(fn, 0)`]: timers.html#timers_settimeout_callback_delay_arg <ide> [child_process `'disconnect'` event]: child_process.html#child_process_event_disconnect <del>[process_emit_warning]: #process_emitwarning_warning_name_ctor <add>[process_emit_warning]: #process_process_emitwarning_warning_name_ctor <ide> [process_warning]: #process_event_warning <ide> [Signal Events]: #process_signal_events <ide> [Stream compatibility]: stream.html#stream_compatibility_with_older_node_js_versions
2
Go
Go
handle ipv6 literals correctly in port bindings
e3c212c2241d07c5dc93f0390f9645033aa5ee60
<ide><path>libnetwork/types/types.go <ide> func (p *PortBinding) String() string { <ide> return ret <ide> } <ide> <del>// FromString reads the PortBinding structure from string <add>// FromString reads the PortBinding structure from string s. <add>// String s is a triple of "protocol/containerIP:port/hostIP:port" <add>// containerIP and hostIP can be in dotted decimal ("192.0.2.1") or IPv6 ("2001:db8::68") form. <add>// Zoned addresses ("169.254.0.23%eth0" or "fe80::1ff:fe23:4567:890a%eth0") are not supported. <add>// If string s is incorrectly formatted or the IP addresses or ports cannot be parsed, FromString <add>// returns an error. <ide> func (p *PortBinding) FromString(s string) error { <ide> ps := strings.Split(s, "/") <ide> if len(ps) != 3 { <ide> func (p *PortBinding) FromString(s string) error { <ide> } <ide> <ide> func parseIPPort(s string) (net.IP, uint16, error) { <del> pp := strings.Split(s, ":") <del> if len(pp) != 2 { <del> return nil, 0, BadRequestErrorf("invalid format: %s", s) <add> hoststr, portstr, err := net.SplitHostPort(s) <add> if err != nil { <add> return nil, 0, err <ide> } <ide> <del> var ip net.IP <del> if pp[0] != "" { <del> if ip = net.ParseIP(pp[0]); ip == nil { <del> return nil, 0, BadRequestErrorf("invalid ip: %s", pp[0]) <del> } <add> ip := net.ParseIP(hoststr) <add> if ip == nil { <add> return nil, 0, BadRequestErrorf("invalid ip: %s", hoststr) <ide> } <ide> <del> port, err := strconv.ParseUint(pp[1], 10, 16) <add> port, err := strconv.ParseUint(portstr, 10, 16) <ide> if err != nil { <del> return nil, 0, BadRequestErrorf("invalid port: %s", pp[1]) <add> return nil, 0, BadRequestErrorf("invalid port: %s", portstr) <ide> } <ide> <ide> return ip, uint16(port), nil <ide><path>libnetwork/types/types_test.go <ide> package types <ide> <ide> import ( <ide> "flag" <add> "github.com/stretchr/testify/require" <ide> "net" <ide> "testing" <ide> ) <ide> func TestTransportPortConv(t *testing.T) { <ide> } <ide> <ide> func TestTransportPortBindingConv(t *testing.T) { <del> sform := "tcp/172.28.30.23:80/112.0.43.56:8001" <del> pb := &PortBinding{ <del> Proto: TCP, <del> IP: net.IPv4(172, 28, 30, 23), <del> Port: uint16(80), <del> HostIP: net.IPv4(112, 0, 43, 56), <del> HostPort: uint16(8001), <add> input := []struct { <add> sform string <add> pb PortBinding <add> shouldFail bool <add> }{ <add> { // IPv4 -> IPv4 <add> sform: "tcp/172.28.30.23:80/112.0.43.56:8001", <add> pb: PortBinding{ <add> Proto: TCP, <add> IP: net.IPv4(172, 28, 30, 23), <add> Port: uint16(80), <add> HostIP: net.IPv4(112, 0, 43, 56), <add> HostPort: uint16(8001), <add> }, <add> }, <add> { // IPv6 -> IPv4 <add> sform: "tcp/[2001:db8::1]:80/112.0.43.56:8001", <add> pb: PortBinding{ <add> Proto: TCP, <add> IP: net.IP{0x20, 0x01, 0x0d, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, <add> Port: uint16(80), <add> HostIP: net.IPv4(112, 0, 43, 56), <add> HostPort: uint16(8001), <add> }, <add> }, <add> { // IPv4inIPv6 -> IPv4 <add> sform: "tcp/[::ffff:172.28.30.23]:80/112.0.43.56:8001", <add> pb: PortBinding{ <add> Proto: TCP, <add> IP: net.IPv4(172, 28, 30, 23), <add> Port: uint16(80), <add> HostIP: net.IPv4(112, 0, 43, 56), <add> HostPort: uint16(8001), <add> }, <add> }, <add> { // IPv4 -> IPv4 zoned <add> sform: "tcp/172.28.30.23:80/169.254.0.23%eth0:8001", <add> shouldFail: true, <add> }, <add> { // IPv4 -> IPv6 zoned <add> sform: "tcp/172.28.30.23:80/[fe80::1ff:fe23:4567:890a%eth0]:8001", <add> shouldFail: true, <add> }, <ide> } <ide> <del> rc := new(PortBinding) <del> if err := rc.FromString(sform); err != nil { <del> t.Fatal(err) <del> } <del> if !pb.Equal(rc) { <del> t.Fatalf("FromString() method failed") <add> for _, in := range input { <add> rc := new(PortBinding) <add> err := rc.FromString(in.sform) <add> if in.shouldFail { <add> require.Error(t, err, "Unexpected success parsing %s", in.sform) <add> } else { <add> require.NoError(t, err) <add> require.Equal(t, in.pb, *rc, "input %s: expected %#v, got %#v", in.sform, in.pb, rc) <add> } <ide> } <ide> } <ide>
2
Text
Text
add comma to fix typo
c759d83cd3f8d82dbc5f31a0b882f7ec46558786
<ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/understand-functional-programming-terminology.md <ide> But first, let's cover some functional terminology: <ide> <ide> Functions that can be assigned to a variable, passed into another function, or returned from another function just like any other normal value, are called <dfn>first class</dfn> functions. In JavaScript, all functions are first class functions. <ide> <del>The functions that take a function as an argument, or return a function as a return value are called <dfn>higher order</dfn> functions. <add>The functions that take a function as an argument, or return a function as a return value, are called <dfn>higher order</dfn> functions. <ide> <ide> When functions are passed in to or returned from another function, then those functions which were passed in or returned can be called a <dfn>lambda</dfn>. <ide>
1
PHP
PHP
allow array of validation rules on validatewith
a7cf9a11a1f3a379af89856b84a156f8b25bb724
<ide><path>src/Illuminate/Foundation/Validation/ValidatesRequests.php <ide> trait ValidatesRequests <ide> /** <ide> * Run the validation routine against the given validator. <ide> * <del> * @param \Illuminate\Contracts\Validation\Validator $validator <add> * @param \Illuminate\Contracts\Validation\Validator|array $validator <ide> * @param \Illuminate\Http\Request|null $request <ide> * @return void <ide> */ <ide> public function validateWith($validator, Request $request = null) <ide> { <ide> $request = $request ?: app('request'); <ide> <add> if (is_array($validator)) { <add> $validator = $this->getValidationFactory()->make($request->all(), $validator); <add> } <add> <ide> if ($validator->fails()) { <ide> $this->throwValidationException($request, $validator); <ide> }
1
Go
Go
use absolute paths for mount destination strings
930337624250945472001136e7bcb8e5b102bb87
<ide><path>container/container.go <ide> func getSecretTargetPath(r *swarmtypes.SecretReference) string { <ide> return filepath.Join(containerSecretMountPath, r.File.Name) <ide> } <ide> <add>// getConfigTargetPath makes sure that config paths inside the container are <add>// absolute, as required by the runtime spec, and enforced by runc >= 1.0.0-rc94. <add>// see https://github.com/opencontainers/runc/issues/2928 <add>func getConfigTargetPath(r *swarmtypes.ConfigReference) string { <add> if filepath.IsAbs(r.File.Name) { <add> return r.File.Name <add> } <add> <add> return filepath.Join(containerConfigMountPath, r.File.Name) <add>} <add> <ide> // CreateDaemonEnvironment creates a new environment variable slice for this container. <ide> func (container *Container) CreateDaemonEnvironment(tty bool, linkedEnv []string) []string { <ide> // Setup environment <ide><path>container/container_unix.go <ide> const ( <ide> // for the graceful container stop before forcefully terminating it. <ide> DefaultStopTimeout = 10 <ide> <add> containerConfigMountPath = "/" <ide> containerSecretMountPath = "/run/secrets" <ide> ) <ide> <ide> func (container *Container) SecretMounts() ([]Mount, error) { <ide> } <ide> mounts = append(mounts, Mount{ <ide> Source: fPath, <del> Destination: r.File.Name, <add> Destination: getConfigTargetPath(r), <ide> Writable: false, <ide> }) <ide> } <ide><path>container/container_windows.go <ide> import ( <ide> ) <ide> <ide> const ( <add> containerConfigMountPath = `C:\` <ide> containerSecretMountPath = `C:\ProgramData\Docker\secrets` <ide> containerInternalSecretMountPath = `C:\ProgramData\Docker\internal\secrets` <ide> containerInternalConfigsDirPath = `C:\ProgramData\Docker\internal\configs` <ide> func (container *Container) CreateConfigSymlinks() error { <ide> if configRef.File == nil { <ide> continue <ide> } <del> resolvedPath, _, err := container.ResolvePath(configRef.File.Name) <add> resolvedPath, _, err := container.ResolvePath(getConfigTargetPath(configRef)) <ide> if err != nil { <ide> return err <ide> }
3
Javascript
Javascript
use deprecate for global export deprecation
d8040223b1f6d317901c0c0faf5e057ec3e763e0
<ide><path>moment.js <ide> <ide> var moment, <ide> VERSION = "2.5.1", <del> global = this, <add> // the global-scope this is NOT the global object in Node.js <add> global_scope = typeof global !== 'undefined' ? global : this, <ide> round = Math.round, <ide> i, <ide> <ide> function deprecate(msg, fn) { <ide> var first_time = true; <ide> function printMsg() { <del> if (global.console && global.console.warn) { <del> global.console.warn("Deprecation warning: " + msg); <add> if (typeof console !== 'undefined' && console.warn) { <add> console.warn("Deprecation warning: " + msg); <ide> } <ide> } <ide> return extend(function () { <ide> Exposing Moment <ide> ************************************/ <ide> <del> function makeGlobal(deprecate) { <del> var warned = false, local_moment = moment; <add> function makeGlobal(should_deprecate) { <ide> /*global ender:false */ <ide> if (typeof ender !== 'undefined') { <ide> return; <ide> } <del> // here, `this` means `window` in the browser, or `global` on the server <del> // add `moment` as a global object via a string identifier, <del> // for Closure Compiler "advanced" mode <del> if (deprecate) { <del> global.moment = function () { <del> if (!warned && console && console.warn) { <del> warned = true; <del> console.warn( <del> "Accessing Moment through the global scope is " + <del> "deprecated, and will be removed in an upcoming " + <del> "release."); <del> } <del> return local_moment.apply(null, arguments); <del> }; <del> extend(global.moment, local_moment); <add> if (should_deprecate) { <add> global_scope.moment = deprecate( <add> "Accessing Moment through the global scope is " + <add> "deprecated, and will be removed in an upcoming " + <add> "release.", <add> moment); <ide> } else { <del> global['moment'] = moment; <add> global_scope.moment = moment; <ide> } <ide> } <ide>
1
PHP
PHP
improve documentation for viewbuilder
c9642e6251b6a29dcae73117a4655a75a63f1f96
<ide><path>src/View/ViewBuilder.php <ide> class ViewBuilder implements JsonSerializable, Serializable <ide> protected $_name; <ide> <ide> /** <del> * The view variables to use <add> * The view class name to use. <add> * Can either use plugin notation, a short name <add> * or a fully namespaced classname. <ide> * <ide> * @var string <ide> */ <ide> protected $_className; <ide> <ide> /** <del> * The view variables to use <add> * Additional options used when constructing the view. <add> * <add> * This options array lets you provide custom constructor <add> * arguments to application/plugin view classes. <ide> * <ide> * @var array <ide> */ <ide> public function layout($name = null) <ide> /** <ide> * Set additional options for the view. <ide> * <add> * This lets you provide custom constructor arguments to application/plugin view classes. <add> * <ide> * @param array|null $options Either an array of options or null to get current options. <ide> * @param bool $merge Whether or not to merge existing data with the new data. <ide> * @return array|$this <ide> public function name($name = null) <ide> } <ide> <ide> /** <del> * Get/set the view classname <add> * Get/set the view classname. <add> * <add> * Accepts either a short name (Ajax) a plugin name (MyPlugin.Ajax) <add> * or a fully namespaced name (App\View\AppView). <ide> * <ide> * @param string|null $name The class name for the view. Can <ide> * be a plugin.class name reference, a short alias, or a fully
1
Ruby
Ruby
fix small typo in docs
b6f5ea22b749089e6ef9ac1dbe43bd905551d21a
<ide><path>activesupport/lib/active_support/cache.rb <ide> def self.instrument <ide> # bump the cache expiration time by the value set in <tt>:race_condition_ttl</tt>. <ide> # Yes, this process is extending the time for a stale value by another few <ide> # seconds. Because of extended life of the previous cache, other processes <del> # will continue to use slightly stale data for a just a big longer. In the <add> # will continue to use slightly stale data for a just a bit longer. In the <ide> # meantime that first process will go ahead and will write into cache the <ide> # new value. After that all the processes will start getting new value. <ide> # The key is to keep <tt>:race_condition_ttl</tt> small.
1
Mixed
Javascript
normalize scheme for url on android
4b6f02ea758a9ab5853a29ebfc054eaa98e6dc53
<ide><path>Libraries/Linking/Linking.js <ide> class Linking extends NativeEventEmitter { <ide> * See https://facebook.github.io/react-native/docs/linking.html#openurl <ide> */ <ide> openURL(url: string): Promise<any> { <del> // Android Intent requires protocols http and https to be in lowercase. <del> // https:// and http:// works, but Https:// and Http:// doesn't. <del> if (url.toLowerCase().startsWith('https://')) { <del> url = url.replace(url.substr(0, 8), 'https://'); <del> } else if (url.toLowerCase().startsWith('http://')) { <del> url = url.replace(url.substr(0, 7), 'http://'); <del> } <ide> this._validateURL(url); <ide> return LinkingManager.openURL(url); <ide> } <ide><path>ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java <ide> public void openURL(String url, Promise promise) { <ide> <ide> try { <ide> Activity currentActivity = getCurrentActivity(); <del> Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); <add> Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url).normalizeScheme()); <ide> <ide> String selfPackageName = getReactApplicationContext().getPackageName(); <ide> ComponentName componentName = intent.resolveActivity(
2
Text
Text
fix typo in permission_classes
919c5e1e01106918af9f26c506c2198fbf731923
<ide><path>docs/api-guide/authentication.md <ide> Or, if you're using the `@api_view` decorator with function based views. <ide> <ide> @api_view(['GET']) <ide> @authentication_classes((SessionAuthentication, BasicAuthentication)) <del> @permissions_classes((IsAuthenticated,)) <add> @permission_classes((IsAuthenticated,)) <ide> def example_view(request, format=None): <ide> content = { <ide> 'user': unicode(request.user), # `django.contrib.auth.User` instance.
1
Javascript
Javascript
improve coverage of lib/events.js
a596fdf4d6152c0bdf43417fd63684ccfcfcd098
<ide><path>test/parallel/test-event-emitter-emit-context.js <add>'use strict'; <add>const common = require('../common'); <add>const assert = require('assert'); <add>const EventEmitter = require('events'); <add> <add>// Test emit called by other context <add>const EE = new EventEmitter(); <add> <add>// Works as expected if the context has no `constructor.name` <add>{ <add> const ctx = Object.create(null); <add> assert.throws( <add> () => EE.emit.call(ctx, 'error', new Error('foo')), <add> common.expectsError({ name: 'Error', message: 'foo' }) <add> ); <add>} <add> <add>assert.strictEqual(EE.emit.call({}, 'foo'), false); <add><path>test/parallel/test-events-on-async-iterator.js <del><path>test/parallel/test-event-on-async-iterator.js <ide> async function basic() { <ide> assert.strictEqual(ee.listenerCount('error'), 0); <ide> } <ide> <add>async function invalidArgType() { <add> assert.throws(() => on({}, 'foo'), common.expectsError({ <add> code: 'ERR_INVALID_ARG_TYPE', <add> name: 'TypeError', <add> })); <add>} <add> <ide> async function error() { <ide> const ee = new EventEmitter(); <ide> const _err = new Error('kaboom'); <ide> async function abortableOnAfterDone() { <ide> async function run() { <ide> const funcs = [ <ide> basic, <add> invalidArgType, <ide> error, <ide> errorDelayed, <ide> throwInLoop,
2
PHP
PHP
fix serialization of rate limited middleware
f3d4dcb21dc66824611fdde95c8075b694825bf5
<ide><path>src/Illuminate/Queue/Middleware/RateLimited.php <ide> protected function getTimeUntilNextRetry($key) <ide> { <ide> return $this->limiter->availableIn($key) + 3; <ide> } <add> <add> /** <add> * Prepare the object for serialization. <add> * <add> * @return array <add> */ <add> public function __serialize() <add> { <add> return [ <add> 'limiterName' => $this->limiterName, <add> 'shouldRelease' => $this->shouldRelease, <add> ]; <add> } <add> <add> /** <add> * Prepare the object after unserialization. <add> * <add> * @param array $data <add> * @return void <add> */ <add> public function __unserialize(array $data) <add> { <add> $this->limiter = Container::getInstance()->make(RateLimiter::class); <add> <add> $this->limitedName = $data['limiterName']; <add> $this->shouldRelease = $data['shouldRelease']; <add> } <ide> }
1
Text
Text
remove duplicated section in style guide
398e2bdebf305a2245f214106ddba05f27c83f90
<ide><path>website/docs/style-guide/style-guide.md <ide> It's a bit more typing, but it results in the most understandable code and state <ide> <ide> </details> <ide> <del>### Name State Slices Based On the Stored Data <del> <del>As mentioned in [Reducers Should Own the State Shape ](#reducers-should-own-the-state-shape), the standard approach for splitting reducer logic is based on "slices" of state. Correspondingly, `combineReducers` is the standard function for joining those slice reducers into a larger reducer function. <del> <del>The key names in the object passed to `combineReducers` will define the names of the keys in the resulting state object. Be sure to name these keys after the data that is kept inside, and avoid use of the word "reducer" in the key names. Your object should look like `{users: {}, posts: {}}`, rather than `{usersReducer: {}, postsReducer: {}}`. <del> <del><details> <del><summary> <del> <h4>Detailed Explanation</h4> <del></summary> <del>ES6 object literal shorthand makes it easy to define a key name and a value in an object at the same time: <del> <del>```js <del>const data = 42 <del>const obj = { data } <del>// same as: {data: data} <del>``` <del> <del>`combineReducers` accepts an object full of reducer functions, and uses that to generate state objects that have the same key names. This means that the key names in the functions object define the key names in the state object. <del> <del>This results in a common mistake, where a reducer is imported using "reducer" in the variable name, and then passed to `combineReducers` using the object literal shorthand: <del> <del>```js <del>import usersReducer from 'features/users/usersSlice' <del> <del>const rootReducer = combineReducers({ <del> usersReducer <del>}) <del>``` <del> <del>In this case, use of the object literal shorthand created an object like `{usersReducer: usersReducer}`. So, "reducer" is now in the state key name. This is redundant and useless. <del> <del>Instead, define key names that only relate to the data inside. We suggest using explicit `key: value` syntax for clarity: <del> <del>```js <del>import usersReducer from 'features/users/usersSlice' <del>import postsReducer from 'features/posts/postsSlice' <del> <del>const rootReducer = combineReducers({ <del> users: usersReducer, <del> posts: postsReducer <del>}) <del>``` <del> <del>It's a bit more typing, but it results in the most understandable code and state definition. <del> <del></details> <del> <ide> ### Treat Reducers as State Machines <ide> <ide> Many Redux reducers are written "unconditionally". They only look at the dispatched action and calculate a new state value, without basing any of the logic on what the current state might be. This can cause bugs, as some actions may not be "valid" conceptually at certain times depending on the rest of the app logic. For example, a "request succeeded" action should only have a new value calculated if the state says that it's already "loading", or an "update this item" action could be dispatched even if there is no item marked as "being edited".
1
PHP
PHP
remove the $state === 'after' condition
b64c7e3e8405708cde381043ba2f6dec689c425f
<ide><path>lib/Cake/Model/Model.php <ide> public function buildQuery($type = 'first', $query = array()) { <ide> protected function _findAll($state, $query, $results = array()) { <ide> if ($state === 'before') { <ide> return $query; <del> } elseif ($state === 'after') { <del> return $results; <ide> } <add> <add> return $results; <ide> } <ide> <ide> /** <ide> protected function _findFirst($state, $query, $results = array()) { <ide> if ($state === 'before') { <ide> $query['limit'] = 1; <ide> return $query; <del> } elseif ($state === 'after') { <del> if (empty($results[0])) { <del> return array(); <del> } <del> return $results[0]; <ide> } <add> <add> if (empty($results[0])) { <add> return array(); <add> } <add> return $results[0]; <ide> } <ide> <ide> /** <ide> protected function _findCount($state, $query, $results = array()) { <ide> )); <ide> } <ide> return $query; <del> } elseif ($state === 'after') { <del> foreach (array(0, $this->alias) as $key) { <del> if (isset($results[0][$key]['count'])) { <del> if ($query['group']) { <del> return count($results); <del> } <del> return intval($results[0][$key]['count']); <add> } <add> <add> foreach (array(0, $this->alias) as $key) { <add> if (isset($results[0][$key]['count'])) { <add> if ($query['group']) { <add> return count($results); <ide> } <add> return intval($results[0][$key]['count']); <ide> } <del> return false; <ide> } <add> return false; <ide> } <ide> <ide> /** <ide> protected function _findList($state, $query, $results = array()) { <ide> } <ide> list($query['list']['keyPath'], $query['list']['valuePath'], $query['list']['groupPath']) = $list; <ide> return $query; <del> } elseif ($state === 'after') { <del> if (empty($results)) { <del> return array(); <del> } <del> return Hash::combine($results, $query['list']['keyPath'], $query['list']['valuePath'], $query['list']['groupPath']); <ide> } <add> <add> if (empty($results)) { <add> return array(); <add> } <add> return Hash::combine($results, $query['list']['keyPath'], $query['list']['valuePath'], $query['list']['groupPath']); <ide> } <ide> <ide> /** <ide> protected function _findNeighbors($state, $query, $results = array()) { <ide> $query['field'] = $field; <ide> $query['value'] = $value; <ide> return $query; <del> } elseif ($state === 'after') { <del> extract($query); <del> unset($query['conditions'][$field . ' <']); <del> $return = array(); <del> if (isset($results[0])) { <del> $prevVal = Hash::get($results[0], $field); <del> $query['conditions'][$field . ' >='] = $prevVal; <del> $query['conditions'][$field . ' !='] = $value; <del> $query['limit'] = 2; <del> } else { <del> $return['prev'] = null; <del> $query['conditions'][$field . ' >'] = $value; <del> $query['limit'] = 1; <del> } <del> $query['order'] = $field . ' ASC'; <del> $neighbors = $this->find('all', $query); <del> if (!array_key_exists('prev', $return)) { <del> $return['prev'] = isset($neighbors[0]) ? $neighbors[0] : null; <del> } <del> if (count($neighbors) === 2) { <del> $return['next'] = $neighbors[1]; <del> } elseif (count($neighbors) === 1 && !$return['prev']) { <del> $return['next'] = $neighbors[0]; <del> } else { <del> $return['next'] = null; <del> } <del> return $return; <ide> } <add> <add> extract($query); <add> unset($query['conditions'][$field . ' <']); <add> $return = array(); <add> if (isset($results[0])) { <add> $prevVal = Hash::get($results[0], $field); <add> $query['conditions'][$field . ' >='] = $prevVal; <add> $query['conditions'][$field . ' !='] = $value; <add> $query['limit'] = 2; <add> } else { <add> $return['prev'] = null; <add> $query['conditions'][$field . ' >'] = $value; <add> $query['limit'] = 1; <add> } <add> $query['order'] = $field . ' ASC'; <add> $neighbors = $this->find('all', $query); <add> if (!array_key_exists('prev', $return)) { <add> $return['prev'] = isset($neighbors[0]) ? $neighbors[0] : null; <add> } <add> if (count($neighbors) === 2) { <add> $return['next'] = $neighbors[1]; <add> } elseif (count($neighbors) === 1 && !$return['prev']) { <add> $return['next'] = $neighbors[0]; <add> } else { <add> $return['next'] = null; <add> } <add> return $return; <ide> } <ide> <ide> /** <ide> protected function _findNeighbors($state, $query, $results = array()) { <ide> protected function _findThreaded($state, $query, $results = array()) { <ide> if ($state === 'before') { <ide> return $query; <del> } elseif ($state === 'after') { <del> $parent = 'parent_id'; <del> if (isset($query['parent'])) { <del> $parent = $query['parent']; <del> } <del> return Hash::nest($results, array( <del> 'idPath' => '{n}.' . $this->alias . '.' . $this->primaryKey, <del> 'parentPath' => '{n}.' . $this->alias . '.' . $parent <del> )); <ide> } <add> <add> $parent = 'parent_id'; <add> if (isset($query['parent'])) { <add> $parent = $query['parent']; <add> } <add> return Hash::nest($results, array( <add> 'idPath' => '{n}.' . $this->alias . '.' . $this->primaryKey, <add> 'parentPath' => '{n}.' . $this->alias . '.' . $parent <add> )); <ide> } <ide> <ide> /**
1
Go
Go
fix datastore value handling in bitseq
cc6fb95c0c66168a9a41e242a44ad7f7a51a6d7b
<ide><path>libnetwork/bitseq/sequence.go <ide> import ( <ide> "fmt" <ide> "sync" <ide> <del> "github.com/docker/libkv/store" <ide> "github.com/docker/libnetwork/datastore" <ide> "github.com/docker/libnetwork/netutils" <ide> ) <ide> func NewHandle(app string, ds datastore.DataStore, id string, numElements uint32 <ide> // (GetObject() does not set it): It is ok for now, <ide> // it will only cause the first allocation on this <ide> // node to go through a retry. <del> var bs []byte <del> if err := h.store.GetObject(datastore.Key(h.Key()...), bs); err == nil { <del> h.FromByteArray(bs) <del> } else if err != store.ErrKeyNotFound { <del> return nil, err <add> var bah []byte <add> if err := h.store.GetObject(datastore.Key(h.Key()...), &bah); err != nil { <add> if err != datastore.ErrKeyNotFound { <add> return nil, err <add> } <add> return h, nil <ide> } <del> return h, nil <add> err := h.FromByteArray(bah) <add> <add> return h, err <ide> } <ide> <ide> // Sequence reresents a recurring sequence of 32 bits long bitmasks <ide> func (s *Sequence) ToByteArray() ([]byte, error) { <ide> func (s *Sequence) FromByteArray(data []byte) error { <ide> l := len(data) <ide> if l%8 != 0 { <del> return fmt.Errorf("cannot deserialize byte sequence of lenght %d", l) <add> return fmt.Errorf("cannot deserialize byte sequence of lenght %d (%v)", l, data) <ide> } <ide> <ide> p := s <ide> func (h *Handle) PushReservation(bytePos, bitPos int, release bool) error { <ide> } else { <ide> h.unselected-- <ide> } <add> h.dbIndex = nh.dbIndex <ide> h.Unlock() <ide> } <ide> <ide> func (h *Handle) ToByteArray() ([]byte, error) { <ide> copy(ba[4:8], netutils.U32ToA(h.unselected)) <ide> bm, err := h.head.ToByteArray() <ide> if err != nil { <del> return nil, err <add> return nil, fmt.Errorf("failed to serialize head: %s", err.Error()) <ide> } <ide> ba = append(ba, bm...) <ide> <ide> func (h *Handle) ToByteArray() ([]byte, error) { <ide> <ide> // FromByteArray reads his handle's data from a byte array <ide> func (h *Handle) FromByteArray(ba []byte) error { <add> if ba == nil { <add> return fmt.Errorf("nil byte array") <add> } <add> <ide> nh := &Sequence{} <ide> err := nh.FromByteArray(ba[8:]) <ide> if err != nil { <del> return err <add> return fmt.Errorf("failed to deserialize head: %s", err.Error()) <ide> } <ide> <ide> h.Lock() <ide><path>libnetwork/bitseq/store.go <ide> package bitseq <ide> <ide> import ( <add> "encoding/json" <add> "fmt" <add> <add> log "github.com/Sirupsen/logrus" <ide> "github.com/docker/libnetwork/datastore" <ide> "github.com/docker/libnetwork/types" <ide> ) <ide> func (h *Handle) KeyPrefix() []string { <ide> func (h *Handle) Value() []byte { <ide> b, err := h.ToByteArray() <ide> if err != nil { <add> log.Warnf("Failed to serialize Handle: %v", err) <add> b = []byte{} <add> } <add> jv, err := json.Marshal(b) <add> if err != nil { <add> log.Warnf("Failed to json encode bitseq handler byte array: %v", err) <ide> return []byte{} <ide> } <del> return b <add> return jv <ide> } <ide> <ide> // Index returns the latest DB Index as seen by this object <ide> func (h *Handle) watchForChanges() error { <ide> case kvPair := <-kvpChan: <ide> // Only process remote update <ide> if kvPair != nil && (kvPair.LastIndex != h.getDBIndex()) { <del> h.Lock() <del> h.dbIndex = kvPair.LastIndex <del> h.Unlock() <del> h.FromByteArray(kvPair.Value) <add> err := h.fromDsValue(kvPair.Value) <add> if err != nil { <add> log.Warnf("Failed to reconstruct bitseq handle from ds watch: %s", err.Error()) <add> } else { <add> h.Lock() <add> h.dbIndex = kvPair.LastIndex <add> h.Unlock() <add> } <ide> } <ide> } <ide> } <ide> }() <ide> return nil <ide> } <ide> <add>func (h *Handle) fromDsValue(value []byte) error { <add> var ba []byte <add> if err := json.Unmarshal(value, &ba); err != nil { <add> return fmt.Errorf("failed to decode json: %s", err.Error()) <add> } <add> if err := h.FromByteArray(ba); err != nil { <add> return fmt.Errorf("failed to decode handle: %s", err.Error()) <add> } <add> return nil <add>} <add> <ide> func (h *Handle) writeToStore() error { <ide> h.Lock() <ide> store := h.store <ide><path>libnetwork/idm/idm.go <ide> func New(ds datastore.DataStore, id string, start, end uint32) (*Idm, error) { <ide> <ide> h, err := bitseq.NewHandle("idm", ds, id, uint32(1+end-start)) <ide> if err != nil { <del> return nil, err <add> return nil, fmt.Errorf("failed to initialize bit sequence handler: %s", err.Error()) <ide> } <ide> <ide> return &Idm{start: start, end: end, handle: h}, nil
3
Java
Java
add check for valid roottag in reactrootview
c893989d21ad7a68a4b3117fee2b9ebba745b03c
<ide><path>ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java <ide> public void setEventListener(ReactRootViewEventListener eventListener) { <ide> public void setAppProperties(@Nullable Bundle appProperties) { <ide> UiThreadUtil.assertOnUiThread(); <ide> mAppProperties = appProperties; <del> runApplication(); <add> if (getRootViewTag() != 0) { <add> runApplication(); <add> } <ide> } <ide> <ide> /**
1
Text
Text
fix typo of upgrading
25716a249d6e6778b2eb9b9fc0e3bf7154619945
<ide><path>docs/upgrading.md <ide> Minification using SWC is an opt-in flag to ensure it can be tested against more <ide> <ide> If your application has specific CSS targeting span, for example `.container span`, upgrading to Next.js 12 might incorrectly match the wrapping element inside the `<Image>` component. You can avoid this by restricting the selector to a specific class such as `.container span.item` and updating the relevant component with that className, such as `<span className="item" />`. <ide> <del>If you application has specific CSS targeting the `next/image` `<div>` tag, for example `.container div`, it may not match anymore. You can update the selector `.container span`, or preferably, add a new `<div className="wrapper">` wrapping the `<Image>` component and target that instead such as `.container .wrapper`. <add>If your application has specific CSS targeting the `next/image` `<div>` tag, for example `.container div`, it may not match anymore. You can update the selector `.container span`, or preferably, add a new `<div className="wrapper">` wrapping the `<Image>` component and target that instead such as `.container .wrapper`. <ide> <ide> The `className` prop is unchanged and will still be passed to the underlying `<img>` element. <ide> <ide> The `modules` and `render` option for `next/dynamic` have been deprecated since <ide> <ide> This option hasn't been mentioned in the documentation since Next.js 8 so it's less likely that your application is using it. <ide> <del>If you application does use `modules` and `render` you can refer to [the documentation](https://nextjs.org/docs/messages/next-dynamic-modules). <add>If your application does use `modules` and `render` you can refer to [the documentation](https://nextjs.org/docs/messages/next-dynamic-modules). <ide> <ide> ### Remove `Head.rewind` <ide>
1
Python
Python
fix failing tests in tests/models/test_dag.py
07a3c6f0736f86ed4c7fcb44f5b36fd04e99575f
<ide><path>tests/models/test_dag.py <ide> class TestDag(unittest.TestCase): <ide> def setUp(self) -> None: <ide> clear_db_runs() <ide> clear_db_dags() <add> self.patcher_dag_code = patch.object(settings, "STORE_DAG_CODE", False) <add> self.patcher_dag_code.start() <ide> <ide> def tearDown(self) -> None: <ide> clear_db_runs() <ide> clear_db_dags() <add> self.patcher_dag_code.stop() <ide> <ide> @staticmethod <ide> def _clean_up(dag_id: str): <ide> def test_bulk_write_to_db(self): <ide> DAG(f'dag-bulk-sync-{i}', start_date=DEFAULT_DATE, tags=["test-dag"]) for i in range(0, 4) <ide> ] <ide> <del> with assert_queries_count(7): <add> with assert_queries_count(5): <ide> DAG.bulk_write_to_db(dags) <ide> with create_session() as session: <ide> self.assertEqual( <ide> def test_bulk_write_to_db(self): <ide> set(session.query(DagTag.dag_id, DagTag.name).all()) <ide> ) <ide> # Re-sync should do fewer queries <del> with assert_queries_count(4): <add> with assert_queries_count(3): <ide> DAG.bulk_write_to_db(dags) <del> with assert_queries_count(4): <add> with assert_queries_count(3): <ide> DAG.bulk_write_to_db(dags) <ide> # Adding tags <ide> for dag in dags: <ide> dag.tags.append("test-dag2") <del> with assert_queries_count(5): <add> with assert_queries_count(4): <ide> DAG.bulk_write_to_db(dags) <ide> with create_session() as session: <ide> self.assertEqual( <ide> def test_bulk_write_to_db(self): <ide> # Removing tags <ide> for dag in dags: <ide> dag.tags.remove("test-dag") <del> with assert_queries_count(5): <add> with assert_queries_count(4): <ide> DAG.bulk_write_to_db(dags) <ide> with create_session() as session: <ide> self.assertEqual(
1
Go
Go
remove omitempty tag on parallelism
d8b8b129948ef8586f5b2f576533952419e302f2
<ide><path>api/types/swarm/service.go <ide> const ( <ide> type UpdateConfig struct { <ide> // Maximum number of tasks to be updated in one iteration. <ide> // 0 means unlimited parallelism. <del> Parallelism uint64 `json:",omitempty"` <add> Parallelism uint64 <ide> <ide> // Amount of time between updates. <ide> Delay time.Duration `json:",omitempty"`
1
Java
Java
fix javadoc errors in transactionaltel
e0e3143dd56b6a3693434eba8c036715d253bc8c
<ide><path>spring-test/src/main/java/org/springframework/test/context/transaction/TransactionalTestExecutionListener.java <ide> * <em>rolled back</em> after completion of the test; whereas, changes to the <ide> * database during a test that is run with {@code @NotTransactional} will <ide> * <strong>not</strong> be run within a transaction. Test methods that are not <del> * annotated with either {@code @Transactional} (at the class or method level) <del> * or {@code @NotTransactional} will not be run within a transaction. <add> * annotated with {@code @Transactional} (at the class or method level) will not <add> * be run within a transaction. <ide> * <ide> * <p>Transactional commit and rollback behavior can be configured via the <ide> * class-level {@link TransactionConfiguration @TransactionConfiguration} and <ide> * method-level {@link Rollback @Rollback} annotations. <ide> * <ide> * <p>In case there are multiple instances of {@code PlatformTransactionManager} <del> * within the test's {@code ApplicationContext}, @{@code TransactionConfiguration} <add> * within the test's {@code ApplicationContext}, {@code @TransactionConfiguration} <ide> * supports configuring the bean name of the {@code PlatformTransactionManager} <ide> * that should be used to drive transactions. Alternatively, <ide> * {@link TransactionManagementConfigurer} can be implemented in an <ide> * @author Juergen Hoeller <ide> * @since 2.5 <ide> * @see TransactionConfiguration <add> * @see TransactionManagementConfigurer <ide> * @see org.springframework.transaction.annotation.Transactional <ide> * @see org.springframework.test.annotation.NotTransactional <ide> * @see org.springframework.test.annotation.Rollback <ide> public class TransactionalTestExecutionListener extends AbstractTestExecutionLis <ide> * configured to run within a transaction, this method will run <ide> * {@link BeforeTransaction &#064;BeforeTransaction methods} and start a new <ide> * transaction. <del> * <p>Note that if a {@code BeforeTransaction &#064;BeforeTransaction method} fails, <del> * remaining {@code BeforeTransaction &#064;BeforeTransaction methods} will not <del> * be invoked, and a transaction will not be started. <add> * <p>Note that if a {@code @BeforeTransaction} method fails, any remaining <add> * {@code @BeforeTransaction} methods will not be invoked, and a transaction <add> * will not be started. <ide> * @see org.springframework.transaction.annotation.Transactional <ide> * @see org.springframework.test.annotation.NotTransactional <ide> * @see #getTransactionManager(TestContext, String) <ide> public String getName() { <ide> * If a transaction is currently active for the test method of the supplied <ide> * {@link TestContext test context}, this method will end the transaction <ide> * and run {@link AfterTransaction &#064;AfterTransaction methods}. <del> * <p>{@code AfterTransaction &#064;AfterTransaction methods} are guaranteed to be <add> * <p>{@code @AfterTransaction} methods are guaranteed to be <ide> * invoked even if an error occurs while ending the transaction. <ide> */ <ide> @Override <ide> private boolean isShadowed(Method current, Method previous) { <ide> * Retrieves the {@link TransactionConfigurationAttributes} for the <ide> * specified {@link Class class} which may optionally declare or inherit <ide> * {@link TransactionConfiguration &#064;TransactionConfiguration}. If <del> * {@code &#064;TransactionConfiguration} is not present for the supplied <add> * {@code @TransactionConfiguration} is not present for the supplied <ide> * class, the <em>default values</em> for attributes defined in <del> * {@code &#064;TransactionConfiguration} will be used instead. <add> * {@code @TransactionConfiguration} will be used instead. <ide> * @param testContext the test context for which the configuration <ide> * attributes should be retrieved <ide> * @return a new TransactionConfigurationAttributes instance
1
Javascript
Javascript
add a scrubbing getter.
a803484a395965fc7c0aac59f9fbf18536ab858d
<ide><path>src/js/tech/html5.js <ide> class Html5 extends Tech { <ide> this.setupSourcesetHandling_(); <ide> } <ide> <add> this.isScrubbing_ = false; <add> <ide> if (this.el_.hasChildNodes()) { <ide> <ide> const nodes = this.el_.childNodes; <ide> class Html5 extends Tech { <ide> this.isScrubbing_ = isScrubbing; <ide> } <ide> <add> /** <add> * Get whether we are scrubbing or not. <add> * <add> * @return {boolean} isScrubbing <add> * - true for we are currently scrubbing <add> * - false for we are no longer scrubbing <add> */ <add> scrubbing() { <add> return this.isScrubbing_; <add> } <add> <ide> /** <ide> * Set current time for the `HTML5` tech. <ide> * <ide><path>src/js/tech/tech.js <ide> class Tech extends Component { <ide> */ <ide> setScrubbing() {} <ide> <add> /** <add> * Get whether we are scrubbing or not <add> * <add> * @abstract <add> * <add> * @see {Html5#scrubbing} <add> */ <add> scrubbing() {} <add> <ide> /** <ide> * Causes a manual time update to occur if {@link Tech#manualTimeUpdatesOn} was <ide> * previously called.
2
PHP
PHP
use generator paths
69219d3be44391bab7fc2e707a886e7ec849e418
<ide><path>src/Illuminate/Foundation/Console/CommandMakeCommand.php <ide> protected function getPath() <ide> <ide> if (is_null($path)) <ide> { <del> return $this->laravel['path'].'/src/Console'; <add> return $this->laravel['path.commands']; <ide> } <ide> else <ide> { <ide><path>src/Illuminate/Foundation/Console/RequestMakeCommand.php <ide> protected function buildRequestClass($name) <ide> */ <ide> protected function getPath($name) <ide> { <del> return $this->laravel['path'].'/src/Web/Requests/'.$name.'.php'; <add> return $this->laravel['path.requests'].'/'.$name.'.php'; <ide> } <ide> <ide> /** <ide><path>src/Illuminate/Routing/ControllerServiceProvider.php <ide> protected function registerGenerator() <ide> // The controller generator is responsible for building resourceful controllers <ide> // quickly and easily for the developers via the Artisan CLI. We'll go ahead <ide> // and register this command instances in this container for registration. <del> $path = $app['path'].'/src/Web/Controllers'; <del> <ide> $generator = new ControllerGenerator($app['files']); <ide> <del> return new MakeControllerCommand($generator, $path); <add> return new MakeControllerCommand( <add> $generator, $app['path.controllers'] <add> ); <ide> }); <ide> } <ide>
3
PHP
PHP
fix incorrect variable name in docblock
440a825c454800f26344745a7cdabf44288a7400
<ide><path>src/Illuminate/Support/Collection.php <ide> public function slice($offset, $length = null, $preserveKeys = false) <ide> /** <ide> * Get an array with the values of a given key. <ide> * <del> * @param string $column <add> * @param string $value <ide> * @param string $key <ide> * @return array <ide> */
1
Ruby
Ruby
fix filesystem leak in keg tests
975f61d9818c7be1e711d28eaa75d191470fe834
<ide><path>Library/Homebrew/test/test_keg.rb <ide> def test_links_to_symlinks_are_not_removed <ide> a.join("lib", "example2").make_symlink "example" <ide> b.join("lib", "example2").mkpath <ide> <del> Keg.new(a).link <add> a = Keg.new(a) <add> b = Keg.new(b) <add> a.link <ide> <ide> lib = HOMEBREW_PREFIX.join("lib") <ide> assert_equal 2, lib.children.length <del> assert_raises(Keg::ConflictError) { Keg.new(b).link } <add> assert_raises(Keg::ConflictError) { b.link } <ide> assert_equal 2, lib.children.length <add> ensure <add> a.unlink <add> a.uninstall <add> b.uninstall <ide> end <ide> end
1
Ruby
Ruby
fix syntax error
9d02c39e23ed995005e9b7e6c2d4b40b2ebaf2d3
<ide><path>Library/Homebrew/cmd/doctor.rb <ide> def check_xcode_license_approved <ide> # If the user installs Xcode-only, they have to approve the <ide> # license or no "xc*" tool will work. <ide> if `/usr/bin/xcrun clang 2>&1` =~ /license/ and not $?.success? then <<-EOS.undent <del> You have not agreed to the Xcode license. <del> Builds will fail! Agree to the license by opening Xcode.app or running: <del> xcodebuild -license <del> EOS <add> You have not agreed to the Xcode license. <add> Builds will fail! Agree to the license by opening Xcode.app or running: <add> xcodebuild -license <add> EOS <add> end <ide> end <ide> <ide> def check_for_latest_xquartz
1
Javascript
Javascript
fix usages of removed getmodel method in tests
09554615d4d9a4b4fdc95895364a56d75bdf9637
<ide><path>spec/panel-container-element-spec.js <ide> describe('PanelContainerElement', () => { <ide> container.addPanel(panel2) <ide> container.addPanel(panel3) <ide> <del> expect(element.childNodes[2].getModel()).toBe(panel1) <del> expect(element.childNodes[1].getModel()).toBe(panel3) <del> expect(element.childNodes[0].getModel()).toBe(panel2) <add> expect(element.childNodes[2]).toBe(panel1.getElement()) <add> expect(element.childNodes[1]).toBe(panel3.getElement()) <add> expect(element.childNodes[0]).toBe(panel2.getElement()) <ide> }) <ide> <ide> describe('when the container is at the left location', () =>
1
Javascript
Javascript
unify renderapplication across ios and android
23027cd730bb6eb63277b251378713b08a083d9e
<ide><path>Libraries/ReactIOS/AppContainer.js <ide> var AppContainer = React.createClass({ <ide> return ( <ide> <View style={styles.appContainer}> <ide> <View <del> collapsable={false} <add> collapsable={!this.state.inspector} <ide> key={this.state.mainKey} <ide> style={styles.appContainer} ref="main"> <ide> {this.props.children} <ide><path>Libraries/ReactIOS/renderApplication.android.js <del>/** <del> * Copyright (c) 2015-present, Facebook, Inc. <del> * All rights reserved. <del> * <del> * This source code is licensed under the BSD-style license found in the <del> * LICENSE file in the root directory of this source tree. An additional grant <del> * of patent rights can be found in the PATENTS file in the same directory. <del> * <del> * @providesModule renderApplication <del> */ <del> <del>'use strict'; <del> <del>const Inspector = require('Inspector'); <del>const RCTDeviceEventEmitter = require('RCTDeviceEventEmitter'); <del>const React = require('React'); <del>const ReactNative = require('ReactNative'); <del>const StyleSheet = require('StyleSheet'); <del>const Subscribable = require('Subscribable'); <del>const View = require('View'); <del> <del>const invariant = require('fbjs/lib/invariant'); <del> <del>const YellowBox = __DEV__ ? require('YellowBox') : null; <del> <del>// require BackAndroid so it sets the default handler that exits the app if no listeners respond <del>require('BackAndroid'); <del> <del>const AppContainer = React.createClass({ <del> mixins: [Subscribable.Mixin], <del> <del> getInitialState: function() { <del> return { <del> inspectorVisible: false, <del> rootNodeHandle: null, <del> rootImportanceForAccessibility: 'auto', <del> mainKey: 1, <del> }; <del> }, <del> <del> toggleElementInspector: function() { <del> this.setState({ <del> inspectorVisible: !this.state.inspectorVisible, <del> rootNodeHandle: ReactNative.findNodeHandle(this._mainRef), <del> }); <del> }, <del> <del> componentDidMount: function() { <del> this.addListenerOn( <del> RCTDeviceEventEmitter, <del> 'toggleElementInspector', <del> this.toggleElementInspector <del> ); <del> <del> this._unmounted = false; <del> }, <del> <del> renderInspector: function() { <del> return this.state.inspectorVisible ? <del> <Inspector <del> rootTag={this.props.rootTag} <del> inspectedViewTag={this.state.rootNodeHandle} <del> onRequestRerenderApp={(updateInspectedViewTag) => { <del> this.setState( <del> (s) => ({mainKey: s.mainKey + 1}), <del> () => updateInspectedViewTag(ReactNative.findNodeHandle(this._mainRef)) <del> ); <del> }} <del> /> : <del> null; <del> }, <del> <del> componentWillUnmount: function() { <del> this._unmounted = true; <del> }, <del> <del> _setMainRef: function(ref) { <del> this._mainRef = ref; <del> }, <del> <del> render: function() { <del> const RootComponent = this.props.rootComponent; <del> const appView = <del> <View <del> ref={this._setMainRef} <del> key={this.state.mainKey} <del> collapsable={!this.state.inspectorVisible} <del> style={StyleSheet.absoluteFill}> <del> <RootComponent <del> {...this.props.initialProps} <del> rootTag={this.props.rootTag} <del> importantForAccessibility={this.state.rootImportanceForAccessibility} <del> /> <del> </View>; <del> return __DEV__ ? <del> <View style={StyleSheet.absoluteFill}> <del> {appView} <del> <YellowBox /> <del> {this.renderInspector()} <del> </View> : <del> appView; <del> } <del>}); <del> <del>function renderApplication<D, P, S>( <del> RootComponent: ReactClass<P>, <del> initialProps: P, <del> rootTag: any <del>) { <del> invariant( <del> rootTag, <del> 'Expect to have a valid rootTag, instead got ', rootTag <del> ); <del> ReactNative.render( <del> <AppContainer <del> rootComponent={RootComponent} <del> initialProps={initialProps} <del> rootTag={rootTag} <del> />, <del> rootTag <del> ); <del>} <del> <del>module.exports = renderApplication; <add><path>Libraries/ReactIOS/renderApplication.js <del><path>Libraries/ReactIOS/renderApplication.ios.js <ide> var ReactNative = require('ReactNative'); <ide> <ide> var invariant = require('fbjs/lib/invariant'); <ide> <del>function renderApplication<P>( <del> RootComponent: ReactClass<P>, <del> initialProps: P, <add>// require BackAndroid so it sets the default handler that exits the app if no listeners respond <add>require('BackAndroid'); <add> <add>function renderApplication<Props>( <add> RootComponent: ReactClass<Props>, <add> initialProps: Props, <ide> rootTag: any <ide> ) { <ide> invariant( <ide> function renderApplication<P>( <ide> ); <ide> } <ide> <del> <ide> module.exports = renderApplication;
3
Javascript
Javascript
apply babel to .mjs files
734513b9bea3c765eb1dcad741df757047b356a3
<ide><path>packages/next/build/webpack-config.js <ide> export default async function getBaseWebpackConfig (dir, {dev = false, isServer <ide> module: { <ide> rules: [ <ide> { <del> test: /\.(js|jsx)$/, <add> test: /\.(js|mjs|jsx)$/, <ide> include: [dir, /next-server[\\/]dist[\\/]lib/], <ide> exclude: (path) => { <ide> if (/next-server[\\/]dist[\\/]lib/.exec(path)) {
1
Text
Text
improve instruction to purple merge
938b2698e3db13332cce811ed7dd84d061d89419
<ide><path>COLLABORATOR_GUIDE.md <ide> $ git rev-list upstream/master...HEAD | xargs core-validate-commit <ide> Optional: When landing your own commits, force push the amended commit to the <ide> branch you used to open the pull request. If your branch is called `bugfix`, <ide> then the command would be `git push --force-with-lease origin master:bugfix`. <del>When the pull request is closed, this will cause the pull request to <del>show the purple merged status rather than the red closed status that is <del>usually used for pull requests that weren't merged. <add>Don't manually close the PR, GitHub will close it automatically later after you <add>push it upstream, and will mark it with the purple merged status rather than the <add>red closed status. If you close the PR before GitHub adjusts its status, it will <add>show up as a 0 commit PR and the changed file history will be empty. Also if you <add>push upstream before you push to your branch, GitHub will close the issue with <add>red status so the order of operations is important. <ide> <ide> Time to push it: <ide>
1
Javascript
Javascript
add test case
ce71f9b6ab8339082eeaae6b29d83b76a254af69
<ide><path>test/configCases/container/no-shared/index.js <add>it("should allow to work without shared modules", async () => { <add> await __webpack_init_sharing__("default"); <add> const container = __non_webpack_require__("./container.js"); <add> container.init(__webpack_share_scopes__.default); <add> const moduleFactory = await container.get("./module"); <add> expect(moduleFactory().ok).toBe(true); <add>}); <ide><path>test/configCases/container/no-shared/module.js <add>export const ok = true; <ide><path>test/configCases/container/no-shared/webpack.config.js <add>const { ModuleFederationPlugin } = require("../../../../").container; <add> <add>/** @type {import("../../../../").Configuration} */ <add>module.exports = { <add> plugins: [ <add> new ModuleFederationPlugin({ <add> name: "container", <add> filename: "container.js", <add> library: { type: "commonjs-module" }, <add> exposes: ["./module"] <add> }) <add> ] <add>};
3
PHP
PHP
fix bug in route caching and route names
ea3b8a3f535443b37f9bf29f2e15ab09f2a2460f
<ide><path>src/Illuminate/Routing/RouteServiceProvider.php <ide> public function boot() <ide> <ide> if ($this->app->routesAreCached()) <ide> { <del> require $this->app->getRouteCachePath(); <add> $this->app->booted(function() <add> { <add> require $this->app->getRouteCachePath(); <add> }); <ide> } <ide> else <ide> { <ide><path>src/Illuminate/Routing/Router.php <ide> public function setRoutes(RouteCollection $routes) <ide> } <ide> <ide> $this->routes = $routes; <add> <add> $this->container->instance('routes', $this->routes); <ide> } <ide> <ide> /** <ide><path>src/Illuminate/Routing/RoutingServiceProvider.php <ide> protected function registerUrlGenerator() <ide> // and all the registered routes will be available to the generator. <ide> $routes = $app['router']->getRoutes(); <ide> <del> return new UrlGenerator($routes, $app->rebinding('request', function($app, $request) <add> $app->instance('routes', $routes); <add> <add> $url = new UrlGenerator($routes, $app->rebinding('request', function($app, $request) <ide> { <ide> $app['url']->setRequest($request); <ide> })); <add> <add> // If the route collection is "rebound", for example, when the routes stay <add> // cached for the application, we will need to rebind the routes on the <add> // URL generator instance so it has the latest version of the routes. <add> $app->rebinding('routes', function($app, $routes) <add> { <add> $app['url']->setRoutes($routes); <add> }); <add> <add> return $url; <ide> }); <ide> } <ide>
3
Javascript
Javascript
fix duration functions to follow tests
e3c482b2deedb8d9ca53b196082b21e8d532c5cb
<ide><path>src/lib/duration/as.js <ide> import { normalizeUnits } from '../units/aliases'; <ide> import toInt from '../utils/to-int'; <ide> <ide> export function as (units) { <add> if (!this.isValid()) { <add> return NaN; <add> } <ide> var days; <ide> var months; <ide> var milliseconds = this._milliseconds; <ide> export function as (units) { <ide> <ide> // TODO: Use this.as('ms')? <ide> export function valueOf () { <add> if (!this.isValid()) { <add> return NaN; <add> } <ide> return ( <ide> this._milliseconds + <ide> this._days * 864e5 + <ide><path>src/lib/duration/get.js <ide> import absFloor from '../utils/abs-floor'; <ide> <ide> export function get (units) { <ide> units = normalizeUnits(units); <del> return this[units + 's'](); <add> return this.isValid() ? this[units + 's']() : NaN; <ide> } <ide> <ide> function makeGetter(name) { <ide> return function () { <del> return this._data[name]; <add> return this.isValid() ? this._data[name] : NaN; <ide> }; <ide> } <ide> <ide><path>src/lib/duration/iso-string.js <ide> export function toISOString() { <ide> // This is because there is no context-free conversion between hours and days <ide> // (think of clock changes) <ide> // and also not between days and months (28-31 days per month) <add> if (!this.isValid()) { <add> return this.localeData().invalidDate(); <add> } <add> <ide> var seconds = abs(this._milliseconds) / 1000; <ide> var days = abs(this._days); <ide> var months = abs(this._months); <ide> export function toISOString() { <ide> (m ? m + 'M' : '') + <ide> (s ? s + 'S' : ''); <ide> } <add> <add>export function toJSON() { <add> // this may not be fully implemented <add> return this.isValid() ? this.toISOString() : null; <add>} <ide><path>src/lib/duration/prototype.js <ide> import { as, asMilliseconds, asSeconds, asMinutes, asHours, asDays, asWeeks, asM <ide> import { bubble } from './bubble'; <ide> import { get, milliseconds, seconds, minutes, hours, days, months, years, weeks } from './get'; <ide> import { humanize } from './humanize'; <del>import { toISOString } from './iso-string'; <add>import { toISOString, toJSON } from './iso-string'; <ide> import { lang, locale, localeData } from '../moment/locale'; <ide> <ide> proto.abs = abs; <ide> proto.years = years; <ide> proto.humanize = humanize; <ide> proto.toISOString = toISOString; <ide> proto.toString = toISOString; <del>proto.toJSON = toISOString; <add>proto.toJSON = toJSON; <ide> proto.locale = locale; <ide> proto.localeData = localeData; <ide> <ide><path>src/test/moment/duration.js <ide> test('null instantiation', function (assert) { <ide> }); <ide> <ide> test('NaN instantiation', function (assert) { <del> assert.equal(moment.duration(NaN).milliseconds(), 0, 'milliseconds'); <add> assert.ok(isNaN(moment.duration(NaN).milliseconds()), 'milliseconds should be NaN'); <ide> assert.equal(moment.duration(NaN).isValid(), false, '_isValid'); <ide> assert.equal(moment.duration(NaN).humanize(), 'Invalid date', 'Duration should be invalid'); <ide> }); <ide><path>src/test/moment/duration_invalid.js <ide> import moment from '../../moment'; <ide> <ide> module('invalid'); <ide> <del>test('invalid', function (assert) { <add>test('invalid duration', function (assert) { <ide> var m = moment.duration(NaN); // should be invalid <ide> assert.equal(m.isValid(), false); <ide> assert.ok(isNaN(m.valueOf())); <ide> test('invalid', function (assert) { <ide> // assert.ok(isNaN(m.valueOf())); <ide> // }); <ide> <del>test('invalid operations', function (assert) { <add>test('invalid duration operations', function (assert) { <ide> var invalids = [ <ide> moment.duration(NaN) <ide> // moment.duration({invalidMonth : 'whatchamacallit'})
6
PHP
PHP
change config name
b3a9b21e6a3c7bacc4349ec986b8488a9e7d622f
<ide><path>src/Illuminate/Database/Connectors/SqlServerConnector.php <ide> protected function getDsn(array $config) <ide> */ <ide> protected function getOdbcDsn(array $config) <ide> { <del> if (isset($config['ODBC_DATA_SOURCE_NAME'])) { <del> return 'odbc:'.$config['ODBC_DATA_SOURCE_NAME']; <add> if (isset($config['odbc_datasource_name'])) { <add> return 'odbc:'.$config['odbc_datasource_name']; <ide> } else { <ide> return ''; <ide> }
1
Mixed
Ruby
improve generator implied option handling
4c67975c9c955d0af286d0237eed3ed243676762
<ide><path>railties/CHANGELOG.md <add>* `--no-*` options now work with the app generator's `--minimal` option, and <add> are both comprehensive and precise. For example: <add> <add> ```console <add> $ rails new my_cool_app --minimal <add> Based on the specified options, the following options will also be activated: <add> <add> --skip-active-job [due to --minimal] <add> --skip-action-mailer [due to --skip-active-job, --minimal] <add> --skip-active-storage [due to --skip-active-job, --minimal] <add> --skip-action-mailbox [due to --skip-active-storage, --minimal] <add> --skip-action-text [due to --skip-active-storage, --minimal] <add> --skip-javascript [due to --minimal] <add> --skip-hotwire [due to --skip-javascript, --minimal] <add> --skip-action-cable [due to --minimal] <add> --skip-bootsnap [due to --minimal] <add> --skip-dev-gems [due to --minimal] <add> --skip-system-test [due to --minimal] <add> <add> ... <add> <add> $ rails new my_cool_app --minimal --no-skip-active-storage <add> Based on the specified options, the following options will also be activated: <add> <add> --skip-action-mailer [due to --minimal] <add> --skip-action-mailbox [due to --minimal] <add> --skip-action-text [due to --minimal] <add> --skip-javascript [due to --minimal] <add> --skip-hotwire [due to --skip-javascript, --minimal] <add> --skip-action-cable [due to --minimal] <add> --skip-bootsnap [due to --minimal] <add> --skip-dev-gems [due to --minimal] <add> --skip-system-test [due to --minimal] <add> <add> ... <add> ``` <add> <add> *Brad Trick* and *Jonathan Hefner* <add> <ide> * Add `--skip-dev-gems` option to app generator to skip adding development <ide> gems (like `web-console`) to the Gemfile. <ide> <ide><path>railties/lib/rails/generators/app_base.rb <ide> require "digest/md5" <ide> require "rails/version" unless defined?(Rails::VERSION) <ide> require "open-uri" <add>require "tsort" <ide> require "uri" <ide> require "rails/generators" <ide> require "active_support/core_ext/array/extract_options" <ide> def self.add_shared_options_for(name) <ide> class_option :database, type: :string, aliases: "-d", default: "sqlite3", <ide> desc: "Preconfigure for selected database (options: #{DATABASES.join('/')})" <ide> <del> class_option :skip_git, type: :boolean, aliases: "-G", default: false, <add> class_option :skip_git, type: :boolean, aliases: "-G", default: nil, <ide> desc: "Skip git init, .gitignore and .gitattributes" <ide> <del> class_option :skip_keeps, type: :boolean, default: false, <add> class_option :skip_keeps, type: :boolean, default: nil, <ide> desc: "Skip source control .keep files" <ide> <ide> class_option :skip_action_mailer, type: :boolean, aliases: "-M", <del> default: false, <add> default: nil, <ide> desc: "Skip Action Mailer files" <ide> <del> class_option :skip_action_mailbox, type: :boolean, default: false, <add> class_option :skip_action_mailbox, type: :boolean, default: nil, <ide> desc: "Skip Action Mailbox gem" <ide> <del> class_option :skip_action_text, type: :boolean, default: false, <add> class_option :skip_action_text, type: :boolean, default: nil, <ide> desc: "Skip Action Text gem" <ide> <del> class_option :skip_active_record, type: :boolean, aliases: "-O", default: false, <add> class_option :skip_active_record, type: :boolean, aliases: "-O", default: nil, <ide> desc: "Skip Active Record files" <ide> <del> class_option :skip_active_job, type: :boolean, default: false, <add> class_option :skip_active_job, type: :boolean, default: nil, <ide> desc: "Skip Active Job" <ide> <del> class_option :skip_active_storage, type: :boolean, default: false, <add> class_option :skip_active_storage, type: :boolean, default: nil, <ide> desc: "Skip Active Storage files" <ide> <del> class_option :skip_action_cable, type: :boolean, aliases: "-C", default: false, <add> class_option :skip_action_cable, type: :boolean, aliases: "-C", default: nil, <ide> desc: "Skip Action Cable files" <ide> <del> class_option :skip_asset_pipeline, type: :boolean, aliases: "-A", default: false <add> class_option :skip_asset_pipeline, type: :boolean, aliases: "-A", default: nil <ide> <ide> class_option :asset_pipeline, type: :string, aliases: "-a", default: "sprockets", <ide> desc: "Choose your asset pipeline [options: sprockets (default), propshaft]" <ide> <del> class_option :skip_javascript, type: :boolean, aliases: ["-J", "--skip-js"], default: name == "plugin", <add> class_option :skip_javascript, type: :boolean, aliases: ["-J", "--skip-js"], default: (true if name == "plugin"), <ide> desc: "Skip JavaScript files" <ide> <del> class_option :skip_hotwire, type: :boolean, default: false, <add> class_option :skip_hotwire, type: :boolean, default: nil, <ide> desc: "Skip Hotwire integration" <ide> <del> class_option :skip_jbuilder, type: :boolean, default: false, <add> class_option :skip_jbuilder, type: :boolean, default: nil, <ide> desc: "Skip jbuilder gem" <ide> <del> class_option :skip_test, type: :boolean, aliases: "-T", default: false, <add> class_option :skip_test, type: :boolean, aliases: "-T", default: nil, <ide> desc: "Skip test files" <ide> <del> class_option :skip_system_test, type: :boolean, default: false, <add> class_option :skip_system_test, type: :boolean, default: nil, <ide> desc: "Skip system test files" <ide> <del> class_option :skip_bootsnap, type: :boolean, default: false, <add> class_option :skip_bootsnap, type: :boolean, default: nil, <ide> desc: "Skip bootsnap gem" <ide> <del> class_option :skip_dev_gems, type: :boolean, default: false, <add> class_option :skip_dev_gems, type: :boolean, default: nil, <ide> desc: "Skip development gems (e.g., web-console)" <ide> <del> class_option :dev, type: :boolean, default: false, <add> class_option :dev, type: :boolean, default: nil, <ide> desc: "Set up the #{name} with Gemfile pointing to your Rails checkout" <ide> <del> class_option :edge, type: :boolean, default: false, <add> class_option :edge, type: :boolean, default: nil, <ide> desc: "Set up the #{name} with Gemfile pointing to Rails repository" <ide> <del> class_option :main, type: :boolean, default: false, aliases: "--master", <add> class_option :main, type: :boolean, default: nil, aliases: "--master", <ide> desc: "Set up the #{name} with Gemfile pointing to Rails repository main branch" <ide> <ide> class_option :rc, type: :string, default: nil, <ide> desc: "Path to file containing extra configuration options for rails command" <ide> <del> class_option :no_rc, type: :boolean, default: false, <add> class_option :no_rc, type: :boolean, default: nil, <ide> desc: "Skip loading of extra configuration options from .railsrc file" <ide> <ide> class_option :help, type: :boolean, aliases: "-h", group: :rails, <ide> def build(meth, *args) # :doc: <ide> builder.public_send(meth, *args) if builder.respond_to?(meth) <ide> end <ide> <add> def deduce_implied_options(options, option_reasons, meta_options) <add> active = options.transform_values { |value| [] if value }.compact <add> irrevocable = (active.keys - meta_options).to_set <add> <add> deduction_order = TSort.tsort( <add> ->(&block) { option_reasons.each_key(&block) }, <add> ->(key, &block) { option_reasons[key]&.each(&block) } <add> ) <add> <add> deduction_order.each do |name| <add> reasons = option_reasons[name]&.select(&active).presence <add> active[name] ||= reasons if reasons <add> irrevocable << name if reasons&.any?(irrevocable) <add> end <add> <add> revoked = options.select { |name, value| value == false }.keys.to_set - irrevocable <add> deduction_order.reverse_each do |name| <add> revoked += option_reasons[name].to_a if revoked.include?(name) <add> end <add> revoked -= meta_options <add> <add> active.filter_map do |name, reasons| <add> reasons -= revoked.to_a <add> [name, reasons] unless revoked.include?(name) || reasons.empty? <add> end.to_h <add> end <add> <add> OPTION_IMPLICATIONS = { # :nodoc: <add> skip_active_job: [:skip_action_mailer, :skip_active_storage], <add> skip_active_record: [:skip_active_storage], <add> skip_active_storage: [:skip_action_mailbox, :skip_action_text], <add> skip_javascript: [:skip_hotwire], <add> } <add> <add> def imply_options(option_implications = OPTION_IMPLICATIONS, meta_options: []) <add> option_reasons = {} <add> option_implications.each do |reason, implications| <add> implications.each do |implication| <add> (option_reasons[implication.to_s] ||= []) << reason.to_s <add> end <add> end <add> <add> @implied_options = deduce_implied_options(options, option_reasons, meta_options.map(&:to_s)) <add> @implied_options_conflicts = @implied_options.keys.select { |name| options[name] == false } <add> self.options = options.merge(@implied_options.transform_values { true }).freeze <add> end <add> <add> def report_implied_options <add> return if @implied_options.blank? <add> <add> say "Based on the specified options, the following options will also be activated:" <add> say "" <add> @implied_options.each do |name, reasons| <add> due_to = reasons.map { |reason| "--#{reason.dasherize}" }.join(", ") <add> say " --#{name.dasherize} [due to #{due_to}]" <add> if @implied_options_conflicts.include?(name) <add> say " ERROR: Conflicts with --no-#{name.dasherize}", :red <add> end <add> end <add> say "" <add> <add> raise "Cannot proceed due to conflicting options" if @implied_options_conflicts.any? <add> end <add> <ide> def create_root # :doc: <ide> valid_const? <ide> <ide> def asset_pipeline_gemfile_entry <ide> end <ide> <ide> def include_all_railties? # :doc: <del> [ <del> options.values_at( <del> :skip_active_record, <del> :skip_test, <del> :skip_action_cable, <del> :skip_active_job <del> ), <del> skip_active_storage?, <del> skip_action_mailer?, <del> skip_action_mailbox?, <del> skip_action_text? <del> ].flatten.none? <add> options.values_at( <add> :skip_action_cable, <add> :skip_action_mailbox, <add> :skip_action_mailer, <add> :skip_action_text, <add> :skip_active_job, <add> :skip_active_record, <add> :skip_active_storage, <add> :skip_test, <add> ).none? <ide> end <ide> <ide> def comment_if(value) # :doc: <ide> def sqlite3? # :doc: <ide> end <ide> <ide> def skip_active_storage? # :doc: <del> options[:skip_active_storage] || options[:skip_active_record] || options[:skip_active_job] <add> options[:skip_active_storage] <ide> end <ide> <ide> def skip_action_mailer? # :doc: <del> options[:skip_action_mailer] || options[:skip_active_job] <add> options[:skip_action_mailer] <ide> end <ide> <ide> def skip_action_mailbox? # :doc: <del> options[:skip_action_mailbox] || skip_active_storage? <add> options[:skip_action_mailbox] <ide> end <ide> <ide> def skip_action_text? # :doc: <del> options[:skip_action_text] || skip_active_storage? <add> options[:skip_action_text] <ide> end <ide> <ide> def skip_sprockets? <ide> def javascript_gemfile_entry <ide> end <ide> <ide> def hotwire_gemfile_entry <del> return if options[:skip_javascript] || options[:skip_hotwire] <add> return if options[:skip_hotwire] <ide> <ide> turbo_rails_entry = <ide> GemfileEntry.floats "turbo-rails", "Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]" <ide> def run_javascript <ide> end <ide> <ide> def run_hotwire <del> return if options[:skip_javascript] || options[:skip_hotwire] || !bundle_install? <add> return if options[:skip_hotwire] || !bundle_install? <ide> <ide> rails_command "turbo:install stimulus:install" <ide> end <ide><path>railties/lib/rails/generators/rails/app/app_generator.rb <ide> class AppGenerator < AppBase <ide> class_option :minimal, type: :boolean, desc: "Preconfigure a minimal rails app" <ide> class_option :javascript, type: :string, aliases: ["-j", "--js"], default: "importmap", desc: "Choose JavaScript approach [options: importmap (default), webpack, esbuild, rollup]" <ide> class_option :css, type: :string, aliases: "-c", desc: "Choose CSS processor [options: tailwind, bootstrap, bulma, postcss, sass... check https://github.com/rails/cssbundling-rails]" <del> class_option :skip_bundle, type: :boolean, aliases: "-B", default: false, desc: "Don't run bundle install" <del> class_option :skip_decrypted_diffs, type: :boolean, default: false, desc: "Don't configure git to show decrypted diffs of encrypted credentials" <add> class_option :skip_bundle, type: :boolean, aliases: "-B", default: nil, desc: "Don't run bundle install" <add> class_option :skip_decrypted_diffs, type: :boolean, default: nil, desc: "Don't configure git to show decrypted diffs of encrypted credentials" <ide> <ide> def initialize(*args) <ide> super <ide> <add> imply_options({ <add> **OPTION_IMPLICATIONS, <add> minimal: [ <add> :skip_action_cable, <add> :skip_action_mailbox, <add> :skip_action_mailer, <add> :skip_action_text, <add> :skip_active_job, <add> :skip_active_storage, <add> :skip_bootsnap, <add> :skip_dev_gems, <add> :skip_hotwire, <add> :skip_javascript, <add> :skip_jbuilder, <add> :skip_system_test, <add> ], <add> api: [ <add> :skip_asset_pipeline, <add> :skip_javascript, <add> ], <add> }, meta_options: [:minimal]) <add> <ide> if !options[:skip_active_record] && !DATABASES.include?(options[:database]) <ide> raise Error, "Invalid value for --database option. Supported preconfigurations are: #{DATABASES.join(", ")}." <ide> end <ide> <del> # Force sprockets and JavaScript to be skipped when generating API only apps. <del> # Can't modify options hash as it's frozen by default. <del> if options[:api] <del> self.options = options.merge(skip_asset_pipeline: true, skip_javascript: true).freeze <del> end <del> <del> if options[:minimal] <del> self.options = options.merge( <del> skip_action_cable: true, <del> skip_action_mailer: true, <del> skip_action_mailbox: true, <del> skip_action_text: true, <del> skip_active_job: true, <del> skip_active_storage: true, <del> skip_bootsnap: true, <del> skip_dev_gems: true, <del> skip_javascript: true, <del> skip_jbuilder: true, <del> skip_system_test: true, <del> skip_hotwire: true).freeze <del> end <del> <ide> @after_bundle_callbacks = [] <ide> end <ide> <add> public_task :report_implied_options <ide> public_task :set_default_accessors! <ide> public_task :create_root <ide> public_task :target_rails_prerelease <ide><path>railties/lib/rails/generators/rails/plugin/plugin_generator.rb <ide> class PluginGenerator < AppBase # :nodoc: <ide> def initialize(*args) <ide> @dummy_path = nil <ide> super <add> imply_options <ide> <ide> if !engine? || !with_dummy_app? <ide> self.options = options.merge(skip_asset_pipeline: true).freeze <ide> end <ide> end <ide> <add> public_task :report_implied_options <ide> public_task :set_default_accessors! <ide> public_task :create_root <ide> <ide><path>railties/test/generators/app_generator_test.rb <ide> def test_master_key_is_only_readable_by_the_owner <ide> end <ide> <ide> def test_minimal_rails_app <del> run_generator [destination_root, "--minimal"] <del> <del> assert_no_file "config/storage.yml" <del> assert_no_file "config/cable.yml" <del> assert_no_file "app/views/layouts/mailer.html.erb" <del> assert_no_file "app/jobs/application_job.rb" <del> assert_file "app/views/layouts/application.html.erb" do |content| <del> assert_no_match(/data-turbo-track/, content) <del> end <del> assert_file "config/environments/development.rb" do |content| <del> assert_no_match(/config\.active_storage/, content) <del> end <del> assert_file "config/environments/production.rb" do |content| <del> assert_no_match(/config\.active_job/, content) <del> end <del> assert_file "config/boot.rb" do |content| <del> assert_no_match(/require "bootsnap\/setup"/, content) <del> end <del> assert_file "config/application.rb" do |content| <del> assert_match(/#\s+require\s+["']active_job\/railtie["']/, content) <del> assert_match(/#\s+require\s+["']active_storage\/engine["']/, content) <del> assert_match(/#\s+require\s+["']action_mailer\/railtie["']/, content) <del> assert_match(/#\s+require\s+["']action_mailbox\/engine["']/, content) <del> assert_match(/#\s+require\s+["']action_text\/engine["']/, content) <del> assert_match(/#\s+require\s+["']action_cable\/engine["']/, content) <del> end <del> <del> assert_no_gem "jbuilder" <del> assert_no_gem "web-console" <add> generator([destination_root], ["--minimal"]) <add> <add> assert_option :minimal <add> assert_option :skip_action_cable <add> assert_option :skip_action_mailbox <add> assert_option :skip_action_mailer <add> assert_option :skip_action_text <add> assert_option :skip_active_job <add> assert_option :skip_active_storage <add> assert_option :skip_bootsnap <add> assert_option :skip_dev_gems <add> assert_option :skip_hotwire <add> assert_option :skip_javascript <add> assert_option :skip_jbuilder <add> assert_option :skip_system_test <add> end <add> <add> def test_minimal_rails_app_with_no_skip_implied_option <add> generator([destination_root], ["--minimal", "--no-skip-action-text"]) <add> <add> assert_not_option :skip_action_text <add> assert_not_option :skip_active_storage <add> assert_not_option :skip_active_job <add> assert_option :skip_action_mailbox <add> assert_option :skip_action_mailer <add> assert_option :minimal <add> end <add> <add> def test_minimal_rails_app_with_no_skip_intermediary_implied_option <add> generator([destination_root], ["--minimal", "--no-skip-active-storage"]) <add> <add> assert_not_option :skip_active_storage <add> assert_not_option :skip_active_job <add> assert_option :skip_action_text <add> assert_option :skip_action_mailbox <add> assert_option :skip_action_mailer <add> assert_option :minimal <ide> end <ide> <ide> def test_name_option <ide><path>railties/test/generators/shared_generator_tests.rb <ide> def application_path <ide> destination_root <ide> end <ide> <add> def test_implied_options <add> generator([destination_root], ["--skip-active-job"]) <add> <add> assert_option :skip_action_mailer <add> assert_option :skip_active_storage <add> assert_option :skip_action_mailbox <add> assert_option :skip_action_text <add> assert_not_option :skip_active_record <add> end <add> <add> def test_implied_options_with_conflicting_option <add> error = assert_raises do <add> run_generator [destination_root, "--skip-active-job", "--no-skip-active-storage"] <add> end <add> <add> assert_match %r/conflicting option/i, error.message <add> end <add> <ide> def test_skeleton_is_created <ide> run_generator <ide> <ide> def test_generator_if_skip_action_mailer_is_given <ide> end <ide> assert_no_directory "#{application_path}/app/mailers" <ide> assert_no_directory "#{application_path}/test/mailers" <add> assert_no_file "#{application_path}/app/views/layouts/mailer.html.erb" <ide> end <ide> <ide> def test_generator_if_skip_action_cable_is_given <ide> def run_generator_using_prerelease(args) <ide> end <ide> end <ide> <add> def assert_option(option) <add> assert generator.options[option], "Expected generator option #{option.inspect} to be truthy." <add> end <add> <add> def assert_not_option(option) <add> assert_not generator.options[option], "Expected generator option #{option.inspect} to be falsy." <add> end <add> <ide> def assert_gem(name, constraint = nil) <ide> constraint_pattern = /, #{Regexp.escape constraint}/ if constraint <ide> assert_file "Gemfile", %r/^\s*gem ["']#{name}["']#{constraint_pattern}/
6
Java
Java
avoid request(0) to trigger a recursive call
752c2a7eead3b9e74e701137e6c505ffe924eb87
<ide><path>src/main/java/rx/internal/operators/OperatorMerge.java <ide> private boolean drainQueuesIfNeeded() { <ide> } finally { <ide> boolean moreToDrain = releaseEmitLock(); <ide> // request outside of lock <del> request(emitted); <add> if (emitted > 0) { <add> request(emitted); <add> } <ide> if (!moreToDrain) { <ide> return true; <ide> } <ide> public void request(long n) { <ide> final MergeSubscriber<T> parentSubscriber; <ide> final MergeProducer<T> producer; <ide> /** Make sure the inner termination events are delivered only once. */ <add> @SuppressWarnings("unused") <ide> volatile int terminated; <ide> @SuppressWarnings("rawtypes") <ide> static final AtomicIntegerFieldUpdater<InnerSubscriber> ONCE_TERMINATED = AtomicIntegerFieldUpdater.newUpdater(InnerSubscriber.class, "terminated");
1
Ruby
Ruby
add shorthand for js and css compressors
dab96a267eeccd7380ad99fa19cefdfd3cd5ad2b
<ide><path>actionpack/lib/sprockets/railtie.rb <ide> def asset_environment(app) <ide> env.static_root = File.join(app.root.join("public"), assets.prefix) <ide> env.paths.concat assets.paths <ide> env.logger = Rails.logger <add> env.js_compressor = expand_js_compressor(assets.js_compressor) <add> env.css_compressor = expand_css_compressor(assets.css_compressor) <ide> env <ide> end <add> <add> def expand_js_compressor(sym) <add> case sym <add> when :closure <add> require 'closure-compiler' <add> Closure::Compiler.new <add> when :uglifier <add> require 'uglifier' <add> Uglifier.new <add> when :yui <add> require 'yui/compressor' <add> YUI::JavaScriptCompressor.new <add> else <add> sym <add> end <add> end <add> <add> def expand_css_compressor(sym) <add> case sym <add> when :scss <add> require 'sass' <add> compressor = Object.new <add> def compressor.compress(source) <add> Sass::Engine.new(source, <add> :syntax => :scss, :style => :compressed <add> ).render <add> end <add> compressor <add> when :yui <add> require 'yui/compressor' <add> YUI::JavaScriptCompressor.new(:munge => true) <add> else <add> sym <add> end <add> end <ide> end <ide> end <ide><path>railties/lib/rails/application/configuration.rb <ide> def initialize(*) <ide> @assets.paths = [] <ide> @assets.precompile = [ /\w+\.(?!js|css)$/, "application.js", "application.css" ] <ide> @assets.prefix = "/assets" <add> <add> @assets.js_compressor = nil <add> @assets.css_compressor = nil <ide> end <ide> <ide> def compiled_asset_path
2
Python
Python
update sklearn wrapper tests
dbe13670d963444238abdd064da680108a908856
<ide><path>tests/keras/wrappers/scikit_learn_test.py <ide> def build_fn_clf(hidden_dims): <ide> return model <ide> <ide> <del>def test_clasify_build_fn(): <add>def test_classify_build_fn(): <ide> clf = KerasClassifier( <ide> build_fn=build_fn_clf, hidden_dims=hidden_dims, <ide> batch_size=batch_size, epochs=epochs) <ide> def test_clasify_build_fn(): <ide> assert_string_classification_works(clf) <ide> <ide> <del>def test_clasify_class_build_fn(): <add>def test_classify_class_build_fn(): <ide> class ClassBuildFnClf(object): <ide> <ide> def __call__(self, hidden_dims): <ide> def __call__(self, hidden_dims): <ide> assert_string_classification_works(clf) <ide> <ide> <del>def test_clasify_inherit_class_build_fn(): <add>def test_classify_inherit_class_build_fn(): <ide> class InheritClassBuildFnClf(KerasClassifier): <ide> <ide> def __call__(self, hidden_dims): <ide> def assert_string_classification_works(clf): <ide> string_classes = ['cls{}'.format(x) for x in range(num_class)] <ide> str_y_train = np.array(string_classes)[y_train] <ide> <del> clf.fit(X_train, str_y_train, batch_size=batch_size, nb_epoch=epochs) <add> clf.fit(X_train, str_y_train, batch_size=batch_size, epochs=epochs) <ide> <ide> score = clf.score(X_train, str_y_train, batch_size=batch_size) <ide> assert np.isscalar(score) and np.isfinite(score)
1
PHP
PHP
add test for delete quietly
075dde12e118419dfa5badd26acbe34c7f15c24f
<ide><path>tests/Integration/Database/EloquentDeleteTest.php <ide> public function testForceDeletedEventIsFired() <ide> <ide> $this->assertEquals($role->id, RoleObserver::$model->id); <ide> } <add> <add> public function testDeleteQuietly() <add> { <add> $_SERVER['(-_-)'] = '\(^_^)/'; <add> Post::deleting(fn () => $_SERVER['(-_-)'] = null); <add> Post::deleted(fn () => $_SERVER['(-_-)'] = null); <add> $post = Post::query()->create([]); <add> $result = $post->deleteQuietly(); <add> <add> $this->assertEquals('\(^_^)/', $_SERVER['(-_-)']); <add> $this->assertTrue($result); <add> $this->assertFalse($post->exists); <add> <add> // For a soft-deleted model: <add> Role::deleting(fn () => $_SERVER['(-_-)'] = null); <add> Role::deleted(fn () => $_SERVER['(-_-)'] = null); <add> Role::softDeleted(fn () => $_SERVER['(-_-)'] = null); <add> $role = Role::create([]); <add> $result = $role->deleteQuietly(); <add> $this->assertTrue($result); <add> $this->assertEquals('\(^_^)/', $_SERVER['(-_-)']); <add> <add> unset($_SERVER['(-_-)']); <add> } <ide> } <ide> <ide> class Comment extends Model
1
Ruby
Ruby
remove extra require
c8f2d41fe412f34fc6e5358b6a8be14df5e65db0
<ide><path>Library/Homebrew/test/test_updater.rb <del>abort if ARGV.include? "--skip-update" <del> <ide> require 'testing_env' <del>require 'formula' <ide> require 'cmd/update' <ide> require 'yaml' <ide>
1
Text
Text
add some javascript history
a6a3b685daddbd008757e16ea57bef60f56b38cb
<ide><path>guide/english/javascript/index.md <ide> The official name of JavaScript is ECMAScript defined under Standard [ECMA-262]( <ide> If you want to learn more about the JavaScript language, and why it's so widely used, read Quincy Larson's article - [Which programming language should I learn first?](https://medium.freecodecamp.org/what-programming-language-should-i-learn-first-%CA%87d%C4%B1%C9%B9%C9%94s%C9%90%CA%8C%C9%90%C9%BE-%C9%B9%C7%9D%CA%8Dsu%C9%90-19a33b0a467d) - <ide> or watch this [inspiring video from Preethi Kasireddy](https://www.youtube.com/watch?v=VqiEhZYmvKk). Or else you can watch this [commendable video by Matt Hippely about the history of JavaScript and up to date with modern JavaScript practices.](https://youtu.be/CseCDFed458) <ide> <add>## A Short History of JavaScript <add><h3>1996:</h3> <add><p>It changed from LIVESCRIPT to JAVASCRIPT to attract developers.<br> <add> *JavaScript has nothing to do with Java.</p> <add><h3>1997:</h3> <add><p>JAVASCRIPT was sold to ECMA and become,<br> <add> the first version of JAVASCRIPT Language Standerd.</p> <add><h3>2009:</h3> <add> <p>ES5 (ECMASCRIPT 5) was released with lots of new features.</p> <add><h3>2015:</h3> <add><p>It changed to annual realease cycle,<br> <add> It means JAVASCRIPT releases new Updates every year.<br> <add> (With small feature Updates.)</p> <add><h3>2016/ 2017/18/19:</h3> <add> <p>Releases of versions - ES2016/ ES2017/ ES2018/....</p> <add> <ide> ## Standalone JavaScript engines <ide> A standalone engine is a program which executes code without having to use any other sources for execution. In this case, it executes JavaScript. Most browsers have their own way of dealing with JavaScript. <ide>
1
Ruby
Ruby
remove unused require
486a3697c971fcf5509350cad4155aecad346921
<ide><path>activerecord/test/cases/adapters/mysql/case_sensitivity_test.rb <ide> require "cases/helper" <del>require 'models/person' <ide> <ide> class MysqlCaseSensitivityTest < ActiveRecord::TestCase <ide> class CollationTest < ActiveRecord::Base <ide><path>activerecord/test/cases/adapters/mysql2/case_sensitivity_test.rb <ide> require "cases/helper" <del>require 'models/person' <ide> <ide> class Mysql2CaseSensitivityTest < ActiveRecord::TestCase <ide> class CollationTest < ActiveRecord::Base
2
Javascript
Javascript
use rtl in rtlexample when platform != android
fa69356742e99f1eeb9eae912674ea4941cc16e2
<ide><path>RNTester/js/examples/RTL/RTLExample.js <ide> const BorderExample = withRTLState(({isRTL, setRTL}) => { <ide> }); <ide> <ide> const directionStyle = isRTL => <del> Platform.OS === 'ios' ? {direction: isRTL ? 'rtl' : 'ltr'} : null; <add> Platform.OS !== 'android' ? {direction: isRTL ? 'rtl' : 'ltr'} : null; <ide> <ide> const styles = StyleSheet.create({ <ide> container: {
1
Javascript
Javascript
remove cached bundle if update fails
555430089e130ced054b78fc1aee077439ec20e5
<ide><path>packager/react-packager/src/Server/index.js <ide> class Server { <ide> deps.outdated.add(filePath); <ide> } <ide> }); <add> }).catch(e => { <add> debug(`Could not update bundle: ${e}, evicting from cache`); <add> delete this._bundles[key]; <ide> }); <ide> } <ide> } else {
1
PHP
PHP
remove unused define
d01d291d13c8c4aed4a63b79525bafe905ad9a98
<ide><path>app/Config/core.php <ide> */ <ide> //Configure::write('Cache.viewPrefix', 'prefix'); <ide> <del>/** <del> * Defines the default error type when using the log() function. Used for <del> * differentiating error logging and debugging. Currently PHP supports LOG_DEBUG. <del> */ <del> define('LOG_ERROR', LOG_ERR); <del> <ide> /** <ide> * Session configuration. <ide> * <ide><path>lib/Cake/Console/Templates/skel/Config/core.php <ide> */ <ide> //Configure::write('Cache.viewPrefix', 'prefix'); <ide> <del>/** <del> * Defines the default error type when using the log() function. Used for <del> * differentiating error logging and debugging. Currently PHP supports LOG_DEBUG. <del> */ <del> define('LOG_ERROR', LOG_ERR); <del> <ide> /** <ide> * Session configuration. <ide> *
2
Javascript
Javascript
fix coding style in test/unit/stream_spec.js
9dfc26e1e36272366288aa85047dcf69f15a0f50
<ide><path>test/unit/stream_spec.js <ide> describe('stream', function() { <ide> this.addMatchers({ <ide> toMatchTypedArray: function(expected) { <ide> var actual = this.actual; <del> if (actual.length != expected.length) <add> if (actual.length != expected.length) { <ide> return false; <add> } <ide> for (var i = 0, ii = expected.length; i < ii; i++) { <ide> var a = actual[i], b = expected[i]; <del> if (a !== b) <add> if (a !== b) { <ide> return false; <add> } <ide> } <ide> return true; <ide> } <ide> describe('stream', function() { <ide> dict.set('Columns', 2); <ide> <ide> var input = new Stream(new Uint8Array([2, 100, 3, 2, 1, 255, 2, 1, 255]), <del> 0, 9, dict); <add> 0, 9, dict); <ide> var predictor = new PredictorStream(input, /* length = */ 9, dict); <ide> var result = predictor.getBytes(6); <ide>
1
Javascript
Javascript
create the parser interface
5940d25cc184241ed77aca85c62f4ee071210d9b
<ide><path>packages/react-native-codegen/src/parsers/errors.js <ide> 'use strict'; <ide> <ide> const invariant = require('invariant'); <del> <add>import type {Parser} from './parser'; <ide> export type ParserType = 'Flow' | 'TypeScript'; <ide> <ide> class ParserError extends Error { <ide> class UnsupportedTypeAnnotationParserError extends ParserError { <ide> } <ide> <ide> class UnsupportedGenericParserError extends ParserError { <del> +genericName: string; <add> // +genericName: string; <ide> constructor( <ide> nativeModuleName: string, <ide> genericTypeAnnotation: $FlowFixMe, <del> language: ParserType, <add> parser: Parser, <ide> ) { <del> const genericName = <del> language === 'TypeScript' <del> ? genericTypeAnnotation.typeName.name <del> : genericTypeAnnotation.id.name; <add> const genericName = parser.nameForGenericTypeAnnotation( <add> genericTypeAnnotation, <add> ); <ide> super( <ide> nativeModuleName, <ide> genericTypeAnnotation, <ide> `Unrecognized generic type '${genericName}' in NativeModule spec.`, <ide> ); <ide> <del> this.genericName = genericName; <add> // this.genericName = genericName; <ide> } <ide> } <ide> <ide><path>packages/react-native-codegen/src/parsers/flow/modules/index.js <ide> const { <ide> throwIfMoreThanOneModuleInterfaceParserError, <ide> } = require('../../error-utils'); <ide> <add>const {FlowParser} = require('../parser.js'); <add> <ide> const language = 'Flow'; <add>const parser = new FlowParser(); <ide> <ide> function translateArrayTypeAnnotation( <ide> hasteModuleName: string, <ide> function translateTypeAnnotation( <ide> throw new UnsupportedGenericParserError( <ide> hasteModuleName, <ide> typeAnnotation, <del> language, <add> parser, <ide> ); <ide> } <ide> } <ide><path>packages/react-native-codegen/src/parsers/flow/parser.js <add>/** <add> * Copyright (c) Meta Platforms, Inc. and affiliates. <add> * <add> * This source code is licensed under the MIT license found in the <add> * LICENSE file in the root directory of this source tree. <add> * <add> * @flow strict <add> * @format <add> */ <add> <add>'use strict'; <add> <add>import type {Parser} from '../parser'; <add> <add>class FlowParser implements Parser { <add> nameForGenericTypeAnnotation(typeAnnotation: $FlowFixMe): string { <add> return typeAnnotation.id.name; <add> } <add>} <add> <add>module.exports = { <add> FlowParser, <add>}; <ide><path>packages/react-native-codegen/src/parsers/parser.js <add>/** <add> * Copyright (c) Meta Platforms, Inc. and affiliates. <add> * <add> * This source code is licensed under the MIT license found in the <add> * LICENSE file in the root directory of this source tree. <add> * <add> * @flow strict <add> * @format <add> */ <add> <add>'use strict'; <add> <add>/** <add> * This is the main interface for Parsers of various languages. <add> * It exposes all the methods that contain language-specific logic. <add> */ <add>export interface Parser { <add> /** <add> * Given a type annotation for a generic type, it returns the type name. <add> * @parameter typeAnnotation: the annotation for a type in the AST. <add> * @returns: the name of the type. <add> */ <add> nameForGenericTypeAnnotation(typeAnnotation: $FlowFixMe): string; <add>} <ide><path>packages/react-native-codegen/src/parsers/typescript/modules/index.js <ide> const { <ide> throwIfUnsupportedFunctionReturnTypeAnnotationParserError, <ide> } = require('../../error-utils'); <ide> <add>const {TypeScriptParser} = require('../parser'); <add> <ide> const language = 'TypeScript'; <add>const parser = new TypeScriptParser(); <ide> <ide> function translateArrayTypeAnnotation( <ide> hasteModuleName: string, <ide> function translateTypeAnnotation( <ide> throw new UnsupportedGenericParserError( <ide> hasteModuleName, <ide> typeAnnotation, <del> language, <add> parser, <ide> ); <ide> } <ide> } <ide> function translateTypeAnnotation( <ide> throw new UnsupportedGenericParserError( <ide> hasteModuleName, <ide> typeAnnotation, <del> language, <add> parser, <ide> ); <ide> } <ide> } <ide><path>packages/react-native-codegen/src/parsers/typescript/parser.js <add>/** <add> * Copyright (c) Meta Platforms, Inc. and affiliates. <add> * <add> * This source code is licensed under the MIT license found in the <add> * LICENSE file in the root directory of this source tree. <add> * <add> * @flow strict <add> * @format <add> */ <add> <add>'use strict'; <add> <add>import type {Parser} from '../parser'; <add> <add>class TypeScriptParser implements Parser { <add> nameForGenericTypeAnnotation(typeAnnotation: $FlowFixMe): string { <add> return typeAnnotation.typeName.name; <add> } <add>} <add>module.exports = { <add> TypeScriptParser, <add>};
6
Ruby
Ruby
move resolve_alias from argv to formula
bb01afce4c0804b3603602496292077d3d92f0a4
<ide><path>Library/Homebrew/brew.h.rb <ide> def __make url, name <ide> raise "#{path} already exists" if path.exist? <ide> <ide> if Formula.aliases.include? name and not ARGV.force? <del> realname = HOMEBREW_REPOSITORY.join("Library/Aliases/#{name}").realpath.basename('.rb') <add> realname = Formula.resolve_alias(name) <ide> raise <<-EOS.undent <del> The formula #{realname} is already aliased to #{name} <add> "#{name}" is an alias for formula "#{realname}". <ide> Please check that you are not creating a duplicate. <ide> To force creation use --force. <ide> EOS <ide> def search_brews text <ide> # Filter out aliases when the full name was also found <ide> results.reject do |alias_name| <ide> if aliases.include? alias_name <del> resolved_name = (HOMEBREW_REPOSITORY+"Library/Aliases/#{alias_name}").readlink.basename('.rb').to_s <del> results.include? resolved_name <add> results.include? Formula.resolve_alias(alias_name) <ide> end <ide> end <ide> end <ide><path>Library/Homebrew/extend/ARGV.rb <ide> def options_only <ide> <ide> def formulae <ide> require 'formula' <del> @formulae ||= downcased_unique_named.map{ |name| Formula.factory(resolve_alias(name)) } <add> @formulae ||= downcased_unique_named.map{ |name| Formula.factory(Formula.resolve_alias(name)) } <ide> raise FormulaUnspecifiedError if @formulae.empty? <ide> @formulae <ide> end <ide> <ide> def kegs <ide> require 'keg' <add> require 'formula' <ide> @kegs ||= downcased_unique_named.collect do |name| <del> d = HOMEBREW_CELLAR + resolve_alias(name) <add> d = HOMEBREW_CELLAR + Formula.resolve_alias(name) <ide> dirs = d.children.select{ |pn| pn.directory? } rescue [] <ide> raise "No such keg: #{HOMEBREW_CELLAR}/#{name}" if not d.directory? or dirs.length == 0 <ide> raise "#{name} has multiple installed versions" if dirs.length > 1 <ide> def usage; <<-EOS.undent <ide> EOS <ide> end <ide> <del> def resolve_alias name <del> aka = HOMEBREW_REPOSITORY+"Library/Aliases/#{name}" <del> if aka.file? <del> aka.realpath.basename('.rb').to_s <del> else <del> name <del> end <del> end <del> <ide> private <ide> <ide> def downcased_unique_named <ide><path>Library/Homebrew/formula.rb <ide> def self.aliases <ide> Dir["#{HOMEBREW_REPOSITORY}/Library/Aliases/*"].map{ |f| File.basename f }.sort <ide> end <ide> <add> def self.resolve_alias name <add> aka = HOMEBREW_REPOSITORY+"Library/Aliases/#{name}" <add> if aka.file? <add> aka.realpath.basename('.rb').to_s <add> else <add> name <add> end <add> end <add> <ide> def self.factory name <ide> return name if name.kind_of? Formula <ide> path = Pathname.new(name)
3
Javascript
Javascript
fix console formatter to recognize json properly
1662c37c40c88dd37c35a1a6722c71a23eaa577c
<ide><path>src/node.js <ide> function format (f) { <ide> var i = 1; <ide> var args = arguments; <ide> if (!(f instanceof String)) f = String(f); <del> return f.replace(/%([sdf])/g, function (x) { <add> return f.replace(/%([sdj])/g, function (x) { <ide> switch (x) { <ide> case '%s': return args[i++]; <ide> case '%d': return args[i++].toString();
1
Text
Text
fix a typo in a date for version 13.2.0
f6de66ee711a4159355dfc05a3f5eadb3f1b8cc2
<ide><path>doc/changelogs/CHANGELOG_V13.md <ide> * [Archive](CHANGELOG_ARCHIVE.md) <ide> <ide> <a id="13.2.0"></a> <del>## 2019-21-19, Version 13.2.0 (Current), @MylesBorins <add>## 2019-11-21, Version 13.2.0 (Current), @MylesBorins <ide> <ide> ### Notable Changes <ide>
1
PHP
PHP
add an extra final empty line to the shell output
ab3d362490f5b2c4afc7ecddf6ed55ccdf524ed7
<ide><path>src/Shell/RoutesShell.php <ide> public function main() <ide> $output[] = [$name, $route->template, json_encode($route->defaults)]; <ide> } <ide> $this->helper('table')->output($output); <add> $this->out(); <ide> } <ide> <ide> /** <ide> public function check($url) <ide> [$name, $url, json_encode($route)] <ide> ]; <ide> $this->helper('table')->output($output); <add> $this->out(); <ide> } catch (MissingRouteException $e) { <ide> $this->err("<warning>'$url' did not match any routes.</warning>"); <add> $this->out(); <ide> return false; <ide> } <ide> } <ide> public function generate() <ide> $args = $this->_splitArgs($this->args); <ide> $url = Router::url($args); <ide> $this->out("> $url"); <add> $this->out(); <ide> } catch (MissingRouteException $e) { <ide> $this->err("<warning>The provided parameters do not match any routes.</warning>"); <add> $this->out(); <ide> return false; <ide> } <ide> } <ide><path>tests/TestCase/Shell/RoutesShellTest.php <ide> public function testGenerate() <ide> $this->io->expects($this->at(0)) <ide> ->method('out') <ide> ->with($this->stringContains('> /articles/index')); <del> $this->io->expects($this->at(1)) <add> $this->io->expects($this->at(2)) <ide> ->method('out') <ide> ->with($this->stringContains('> /articles/view/2/3')); <ide>
2
Text
Text
add examples for windows script/build
2c004538a3bed5d79e6ec08c43e0c6884116df45
<ide><path>docs/build-instructions/windows.md <ide> Note: If you use cmd or Powershell instead of Git Shell, use a backslash instead <ide> These instructions will assume the use of Git Shell. <ide> <ide> ### `script/build` Options <del> * `--install-dir` - Creates the final built application in this directory. <del> * `--build-dir` - Build the application in this directory. <add> * `--install-dir` - Creates the final built application in this directory. Example (trailing slash is optional): <add>```bash <add>./script/build --install-dir Z:\Some\Destination\Directory\ <add>``` <add> * `--build-dir` - Build the application in this directory. Example (trailing slash is optional): <add>```bash <add>./script/build --build-dir Z:\Some\Temporary\Directory\ <add>``` <ide> * `--verbose` - Verbose mode. A lot more information output. <ide> <ide> ## Why do I have to use GitHub Desktop?
1
Text
Text
use sentence case for x509 error codes header
09f95541b18dc74d3e7e78317845be80ae6725c7
<ide><path>doc/api/tls.md <ide> The first three are enabled by default. The two `CCM`-based suites are supported <ide> by TLSv1.3 because they may be more performant on constrained systems, but they <ide> are not enabled by default since they offer less security. <ide> <del>## X509 Certificate Error codes <add>## X509 certificate error codes <ide> <ide> Multiple functions can fail due to certificate errors that are reported by <ide> OpenSSL. In such a case, the function provides an {Error} via its callback that
1
Text
Text
fix links in readme
f1b5b15219f8511939df657ffe5da0c9bcf5aee8
<ide><path>research/object_detection/README.md <ide> Please see links below for more details <ide> * [DeepMAC documentation](g3doc/deepmac.md). <ide> * [Mask RCNN code](https://github.com/tensorflow/models/tree/master/official/vision/beta/projects/deepmac_maskrcnn) <ide> in TF Model garden code base. <del>* [DeepMAC Colab](../colab_tutorials/deepmac_colab.ipynb) that lets you run a <add>* [DeepMAC Colab](./colab_tutorials/deepmac_colab.ipynb) that lets you run a <ide> pre-trained DeepMAC model on user-specified boxes. Note that you are not <ide> restricted to COCO classes! <ide> * Project website - [git.io/deepmac](https://git.io/deepmac) <ide><path>research/object_detection/g3doc/deepmac.md <ide> segmentation task. <ide> * `deepmac_meta_arch.py` implements our main architecture, DeepMAC, on top of <ide> the CenterNet detection architecture. <ide> * The proto message `DeepMACMaskEstimation` in `center_net.proto` controls the <del> configutation of the mask head used. <add> configuration of the mask head used. <ide> * The field `allowed_masked_classes_ids` controls which classes recieve mask <ide> supervision during training. <ide> * Mask R-CNN based ablations in the paper are implemented in the
2
PHP
PHP
add deprecated tags
2a88c7f31d896ca9118673a0e2eb33610fff0fb9
<ide><path>src/Controller/Component/SessionComponent.php <ide> public function check($name) { <ide> * @param array $params Parameters to be sent to layout as view variables <ide> * @param string $key Message key, default is 'flash' <ide> * @return void <add> * @deprecated 3.0 Use FlashComponent::set() instead. <ide> * @link http://book.cakephp.org/2.0/en/core-libraries/components/sessions.html#creating-notification-messages <ide> */ <ide> public function setFlash($message, $element = null, array $params = array(), $key = 'flash') { <ide><path>src/View/Helper/SessionHelper.php <ide> public function check($name) { <ide> * @param array $attrs Additional attributes to use for the creation of this flash message. <ide> * Supports the 'params', and 'element' keys that are used in the helper. <ide> * @return string <add> * @deprecated 3.0 Use FlashHelper::render() instead. <ide> * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/session.html#SessionHelper::flash <ide> */ <ide> public function flash($key = 'flash', $attrs = []) {
2
Text
Text
add items using splice verbiage
8b73920487a7448f814aa0c2c123b1366541680e
<ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md <ide> numbers.splice(startIndex, amountToDelete, 13, 14); <ide> console.log(numbers); <ide> ``` <ide> <del>The second entry of `12` is removed, and we add `13` and `14` at the same index. The `numbers` array would now be `[ 10, 11, 12, 13, 14, 15 ]`. <add>The second occurrence of `12` is removed, and we add `13` and `14` at the same index. The `numbers` array would now be `[ 10, 11, 12, 13, 14, 15 ]`. <ide> <ide> Here, we begin with an array of numbers. Then, we pass the following to `splice()`: The index at which to begin deleting elements (3), the number of elements to be deleted (1), and the remaining arguments (13, 14) will be inserted starting at that same index. Note that there can be any number of elements (separated by commas) following `amountToDelete`, each of which gets inserted. <ide>
1
PHP
PHP
update other tests referencing connectionmanager
d48c0850887fcaf263e662fa1450723c8b2306d8
<ide><path>lib/Cake/Console/Command/Task/DbConfigTask.php <ide> <ide> use Cake\Console\Shell; <ide> use Cake\Core\Configure; <del>use Cake\Model\ConnectionManager; <add>use Cake\Database\ConnectionManager; <ide> <ide> /** <ide> * Task class for creating and updating the database configuration file. <ide> public function bake($configs) { <ide> * @return void <ide> */ <ide> public function getConfig() { <del> $configs = ConnectionManager::enumConnectionObjects(); <add> $configs = ConnectionManager::configured(); <ide> <del> $useDbConfig = key($configs); <add> $useDbConfig = current($configs); <ide> if (!is_array($configs) || empty($configs)) { <ide> return $this->execute(); <ide> } <del> $connections = array_keys($configs); <ide> <del> if (count($connections) > 1) { <del> $useDbConfig = $this->in(__d('cake_console', 'Use Database Config') . ':', $connections, $useDbConfig); <add> if (count($configs) > 1) { <add> $useDbConfig = $this->in(__d('cake_console', 'Use Database Config') . ':', $configs, $useDbConfig); <ide> } <ide> return $useDbConfig; <ide> } <ide><path>lib/Cake/Test/TestCase/Cache/CacheTest.php <ide> public static function configProvider() { <ide> }], <ide> ]; <ide> } <add> <ide> /** <ide> * testConfig method <ide> * <ide><path>lib/Cake/Test/TestCase/ORM/BufferedResultSetTest.php <ide> namespace Cake\Test\TestCase\ORM; <ide> <ide> use Cake\Core\Configure; <del>use Cake\Model\ConnectionManager; <add>use Cake\Database\ConnectionManager; <ide> use Cake\ORM\BufferedResultSet; <ide> use Cake\ORM\Query; <ide> use Cake\ORM\Table; <ide> class BufferedResultSetTest extends TestCase { <ide> <ide> public function setUp() { <ide> parent::setUp(); <del> $this->connection = ConnectionManager::getDataSource('test'); <add> $this->connection = ConnectionManager::get('test'); <ide> $this->table = new Table(['table' => 'articles', 'connection' => $this->connection]); <ide> } <ide> <ide><path>lib/Cake/Test/TestCase/ORM/QueryTest.php <ide> use Cake\Core\Configure; <ide> use Cake\Database\Expression\OrderByExpression; <ide> use Cake\Database\Expression\QueryExpression; <del>use Cake\Model\ConnectionManager; <add>use Cake\Database\ConnectionManager; <ide> use Cake\ORM\Query; <ide> use Cake\ORM\ResultSet; <ide> use Cake\ORM\Table; <ide> class QueryTest extends TestCase { <ide> <ide> public function setUp() { <ide> parent::setUp(); <del> $this->connection = ConnectionManager::getDataSource('test'); <add> $this->connection = ConnectionManager::get('test'); <ide> $schema = ['id' => ['type' => 'integer']]; <ide> $schema1 = [ <ide> 'id' => ['type' => 'integer'], <ide><path>lib/Cake/Test/TestCase/ORM/ResultSetTest.php <ide> namespace Cake\Test\TestCase\ORM; <ide> <ide> use Cake\Core\Configure; <del>use Cake\Model\ConnectionManager; <add>use Cake\Database\ConnectionManager; <ide> use Cake\ORM\Query; <ide> use Cake\ORM\ResultSet; <ide> use Cake\ORM\Table; <ide> class ResultSetTest extends TestCase { <ide> <ide> public function setUp() { <ide> parent::setUp(); <del> $this->connection = ConnectionManager::getDataSource('test'); <add> $this->connection = ConnectionManager::get('test'); <ide> $this->table = new Table(['table' => 'articles', 'connection' => $this->connection]); <ide> <ide> $this->fixtureData = [ <ide><path>lib/Cake/Test/TestCase/ORM/TableTest.php <ide> namespace Cake\Test\TestCase\ORM; <ide> <ide> use Cake\Core\Configure; <del>use Cake\Model\ConnectionManager; <add>use Cake\Database\ConnectionManager; <ide> use Cake\ORM\Table; <ide> <ide> /** <ide> class TableTest extends \Cake\TestSuite\TestCase { <ide> <ide> public function setUp() { <ide> parent::setUp(); <del> $this->connection = ConnectionManager::getDataSource('test'); <add> $this->connection = ConnectionManager::get('test'); <ide> } <ide> <ide> public function tearDown() { <ide><path>lib/Cake/TestSuite/Fixture/FixtureManager.php <ide> public function unload(TestCase $test) { <ide> $fixture = $this->_loaded[$f]; <ide> if (!empty($fixture->created)) { <ide> foreach ($fixture->created as $ds) { <del> $db = ConnectionManager::getDataSource($ds); <add> $db = ConnectionManager::get($ds); <ide> $fixture->truncate($db); <ide> } <ide> } <ide> public function loadSingle($name, $db = null, $dropTables = true) { <ide> if (isset($this->_fixtureMap[$name])) { <ide> $fixture = $this->_fixtureMap[$name]; <ide> if (!$db) { <del> $db = ConnectionManager::getDataSource($fixture->connection); <add> $db = ConnectionManager::get($fixture->connection); <ide> } <ide> $this->_setupTable($fixture, $db, $dropTables); <ide> $fixture->truncate($db); <ide> public function shutDown() { <ide> foreach ($this->_loaded as $fixture) { <ide> if (!empty($fixture->created)) { <ide> foreach ($fixture->created as $ds) { <del> $db = ConnectionManager::getDataSource($ds); <add> $db = ConnectionManager::get($ds); <ide> $fixture->drop($db); <ide> } <ide> } <ide><path>lib/Cake/TestSuite/Fixture/TestFixture.php <ide> <ide> use Cake\Core\App; <ide> use Cake\Database\Connection; <add>use Cake\Database\ConnectionManager; <ide> use Cake\Database\Schema\Collection as SchemaCollection; <ide> use Cake\Database\Schema\Table; <ide> use Cake\Error; <ide> use Cake\Log\Log; <del>use Cake\Model\ConnectionManager; <ide> use Cake\Utility\Hash; <ide> use Cake\Utility\Inflector; <ide> <ide> protected function _schemaFromImport() { <ide> throw new Error\Exception(__d('cake_dev', 'Cannot import from undefined table.')); <ide> } <ide> <del> $db = ConnectionManager::getDataSource($import['connection']); <add> $db = ConnectionManager::get($import['connection']); <ide> $schemaCollection = $db->schemaCollection(); <ide> $table = $schemaCollection->describe($import['table']); <ide> $this->_schema = $table; <ide><path>lib/Cake/Utility/ClassRegistry.php <ide> <ide> use Cake\Core\App; <ide> use Cake\Error; <del>use Cake\Model\ConnectionManager; <add>use Cake\Database\ConnectionManager; <ide> use Cake\Model\Model; <ide> <ide> /** <ide> public static function init($class, $strict = false) { <ide> if (isset($defaultProperties['useDbConfig'])) { <ide> $useDbConfig = $defaultProperties['useDbConfig']; <ide> if ($availableDs === null) { <del> $availableDs = array_keys(ConnectionManager::enumConnectionObjects()); <add> $availableDs = ConnectionManager::configured(); <ide> } <ide> if (in_array('test_' . $useDbConfig, $availableDs)) { <ide> $useDbConfig = 'test_' . $useDbConfig;
9
Go
Go
add `truncate` function for go templates
7fa8d5e064bad6d65348a69b623ebb2ecffdf248
<ide><path>pkg/templates/templates.go <ide> var basicFunctions = template.FuncMap{ <ide> a, _ := json.Marshal(v) <ide> return string(a) <ide> }, <del> "split": strings.Split, <del> "join": strings.Join, <del> "title": strings.Title, <del> "lower": strings.ToLower, <del> "upper": strings.ToUpper, <del> "pad": padWithSpace, <add> "split": strings.Split, <add> "join": strings.Join, <add> "title": strings.Title, <add> "lower": strings.ToLower, <add> "upper": strings.ToUpper, <add> "pad": padWithSpace, <add> "truncate": truncateWithLength, <ide> } <ide> <ide> // Parse creates a new anonymous template with the basic functions <ide> func padWithSpace(source string, prefix, suffix int) string { <ide> } <ide> return strings.Repeat(" ", prefix) + source + strings.Repeat(" ", suffix) <ide> } <add> <add>// truncateWithLength truncates the source string up to the length provided by the input <add>func truncateWithLength(source string, length int) string { <add> if len(source) < length { <add> return source <add> } <add> return source[:length] <add>} <ide><path>pkg/templates/templates_test.go <ide> package templates <ide> import ( <ide> "bytes" <ide> "testing" <add> <add> "github.com/docker/docker/pkg/testutil/assert" <ide> ) <ide> <ide> func TestParseStringFunctions(t *testing.T) { <ide> tm, err := Parse(`{{join (split . ":") "/"}}`) <del> if err != nil { <del> t.Fatal(err) <del> } <add> assert.NilError(t, err) <ide> <ide> var b bytes.Buffer <del> if err := tm.Execute(&b, "text:with:colon"); err != nil { <del> t.Fatal(err) <del> } <add> assert.NilError(t, tm.Execute(&b, "text:with:colon")) <ide> want := "text/with/colon" <del> if b.String() != want { <del> t.Fatalf("expected %s, got %s", want, b.String()) <del> } <add> assert.Equal(t, b.String(), want) <ide> } <ide> <ide> func TestNewParse(t *testing.T) { <ide> tm, err := NewParse("foo", "this is a {{ . }}") <del> if err != nil { <del> t.Fatal(err) <del> } <add> assert.NilError(t, err) <ide> <ide> var b bytes.Buffer <del> if err := tm.Execute(&b, "string"); err != nil { <del> t.Fatal(err) <del> } <add> assert.NilError(t, tm.Execute(&b, "string")) <ide> want := "this is a string" <del> if b.String() != want { <del> t.Fatalf("expected %s, got %s", want, b.String()) <add> assert.Equal(t, b.String(), want) <add>} <add> <add>func TestParseTruncateFunction(t *testing.T) { <add> source := "tupx5xzf6hvsrhnruz5cr8gwp" <add> <add> testCases := []struct { <add> template string <add> expected string <add> }{ <add> { <add> template: `{{truncate . 5}}`, <add> expected: "tupx5", <add> }, <add> { <add> template: `{{truncate . 25}}`, <add> expected: "tupx5xzf6hvsrhnruz5cr8gwp", <add> }, <add> { <add> template: `{{truncate . 30}}`, <add> expected: "tupx5xzf6hvsrhnruz5cr8gwp", <add> }, <add> } <add> <add> for _, testCase := range testCases { <add> tm, err := Parse(testCase.template) <add> assert.NilError(t, err) <add> <add> var b bytes.Buffer <add> assert.NilError(t, tm.Execute(&b, source)) <add> assert.Equal(t, b.String(), testCase.expected) <ide> } <ide> }
2
Javascript
Javascript
destroy tls socket if streamwrap is destroyed
b92d55f71811528c38cfdb9ca552502603963360
<ide><path>lib/_tls_wrap.js <ide> function TLSSocket(socket, opts) { <ide> <ide> // Wrap plain JS Stream into StreamWrap <ide> var wrap; <del> if ((socket instanceof net.Socket && socket._handle) || !socket) <add> if ((socket instanceof net.Socket && socket._handle) || !socket) { <ide> wrap = socket; <del> else <add> } else { <ide> wrap = new StreamWrap(socket); <add> wrap.once('close', () => this.destroy()); <add> } <ide> <ide> // Just a documented property to make secure sockets <ide> // distinguishable from regular ones.
1