Skip to content

Instantly share code, notes, and snippets.

@ocarneiro
Last active April 28, 2017 19:24
Show Gist options
  • Save ocarneiro/a9817bf66684d0827a5429df75897c03 to your computer and use it in GitHub Desktop.
Save ocarneiro/a9817bf66684d0827a5429df75897c03 to your computer and use it in GitHub Desktop.
tdd interno primeiro
license: mit
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
</style>
</head>
<body>
<svg width=300 height=300><circle cx=120 cy=120 r=100 style="fill:red" /></svg>
<script>
var circle = d3.select("circle");
function internoPrimeiro(data) {
if (data[0].tipo == "interno") {
return data;
}
return [];
}
var data = [{"tipo": "externo"}, {"tipo": "interno"}];
var output = internoPrimeiro(data);
if (output.length == 2 && output[0].tipo == "interno") {
success();
}
function success() {
circle.attr("style", "fill:green");
}
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment